Skip to content

Conversation

kr-2003
Copy link
Contributor

@kr-2003 kr-2003 commented Sep 20, 2025

This PR enables Out-Of-Process Interpreter for CppInterOp.

Under the hood, it uses LLVM's llvm-jitlink-executor and lib ORC RT to delegate the JIT execution to different process. The user just needs to pass --use-oop-jit flag as ClangArgs while constructing the interpreter to use this feature.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 10 out of 16. Check the log or trigger a new build to see more.

struct FileDeleter {
void operator()(FILE* f /* owns */) {
if (f)
fclose(f);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: calling legacy resource function without passing a 'gsl::owner<>' [cppcoreguidelines-owning-memory]

        fclose(f);
        ^

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

if (llvm::sys::RunningOnValgrind())
GTEST_SKIP() << "XFAIL due to Valgrind report";
TestUtils::CreateInterpreter();
pid_t pid = Cpp::GetExecutorPID();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "pid_t" is directly included [misc-include-cleaner]

unittests/CppInterOp/FunctionReflectionTest.cpp:15:

- #include <string>
+ #include <sched.h>
+ #include <string>

}
}

TInterp_t
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "TInterp_t" is directly included [misc-include-cleaner]

unittests/CppInterOp/Utils.cpp:13:

- #include <string>
+ #include <clang-c/CXCppInterOp.h>
+ #include <string>

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

@mcbarton
Copy link
Collaborator

Before pushing commits to this PR please either ping me, or delete caches as they are made. This PR has caused a large number of llvm cached builds to be deleted on main, which in turn has required multiple PRs workflow runs to be stopped while the cache is rebuilt.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

}

#ifndef _WIN32
pid_t getOutOfProcessExecutorPID() const {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: function 'getOutOfProcessExecutorPID' should be marked [[nodiscard]] [modernize-use-nodiscard]

Suggested change
pid_t getOutOfProcessExecutorPID() const {
[[nodiscard]] pid_t getOutOfProcessExecutorPID() const {

}

#ifndef _WIN32
pid_t getOutOfProcessExecutorPID() const {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: method 'getOutOfProcessExecutorPID' can be made static [readability-convert-member-functions-to-static]

Suggested change
pid_t getOutOfProcessExecutorPID() const {
static pid_t getOutOfProcessExecutorPID() {

}

#ifndef _WIN32
pid_t getOutOfProcessExecutorPID() const {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "pid_t" is directly included [misc-include-cleaner]

lib/CppInterOp/CppInterOpInterpreter.h:25:

- #if CLANG_VERSION_MAJOR >= 19
+ #include <sched.h>
+ #if CLANG_VERSION_MAJOR >= 19

Copy link

codecov bot commented Oct 2, 2025

Codecov Report

❌ Patch coverage is 81.90476% with 19 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.83%. Comparing base (1f43b4e) to head (f5f7fef).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
lib/CppInterOp/CppInterOpInterpreter.h 82.69% 9 Missing ⚠️
lib/CppInterOp/Compatibility.h 73.91% 6 Missing ⚠️
lib/CppInterOp/CppInterOp.cpp 86.66% 4 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #717      +/-   ##
==========================================
- Coverage   79.83%   79.83%   -0.01%     
==========================================
  Files           9        9              
  Lines        3963     4057      +94     
==========================================
+ Hits         3164     3239      +75     
- Misses        799      818      +19     
Files with missing lines Coverage Δ
include/CppInterOp/CppInterOp.h 95.55% <ø> (ø)
lib/CppInterOp/CppInterOp.cpp 88.00% <86.66%> (-0.04%) ⬇️
lib/CppInterOp/Compatibility.h 88.63% <73.91%> (-3.40%) ⬇️
lib/CppInterOp/CppInterOpInterpreter.h 87.19% <82.69%> (-1.42%) ⬇️
Files with missing lines Coverage Δ
include/CppInterOp/CppInterOp.h 95.55% <ø> (ø)
lib/CppInterOp/CppInterOp.cpp 88.00% <86.66%> (-0.04%) ⬇️
lib/CppInterOp/Compatibility.h 88.63% <73.91%> (-3.40%) ⬇️
lib/CppInterOp/CppInterOpInterpreter.h 87.19% <82.69%> (-1.42%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Collaborator

@Vipul-Cariappa Vipul-Cariappa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please look at the comments.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

}
}

TInterp_t
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "TInterp_t" is directly included [misc-include-cleaner]

unittests/CppInterOp/Utils.cpp:15:

- #include <string>
+ #include <clang-c/CXCppInterOp.h>
+ #include <string>

@mcbarton
Copy link
Collaborator

mcbarton commented Oct 5, 2025

Codecov Report

❌ Patch coverage is 74.33628% with 29 lines in your changes missing coverage. Please review. ✅ Project coverage is 80.45%. Comparing base (fe3de3c) to head (cfbb303).
Files with missing lines Patch % Lines
lib/CppInterOp/CppInterOpInterpreter.h 67.39% 15 Missing ⚠️
lib/CppInterOp/Compatibility.h 58.62% 12 Missing ⚠️
lib/CppInterOp/CppInterOp.cpp 94.73% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #717      +/-   ##
==========================================
- Coverage   81.03%   80.45%   -0.59%     
==========================================
  Files           9        9              
  Lines        4214     4307      +93     
==========================================
+ Hits         3415     3465      +50     
- Misses        799      842      +43     

Files with missing lines Coverage Δ
include/CppInterOp/CppInterOp.h 95.55% <ø> (ø)
lib/CppInterOp/CppInterOp.cpp 88.67% <94.73%> (-0.13%) ⬇️
lib/CppInterOp/Compatibility.h 77.53% <58.62%> (-14.50%) ⬇️
lib/CppInterOp/CppInterOpInterpreter.h 83.89% <67.39%> (-4.19%) ⬇️
Files with missing lines Coverage Δ
include/CppInterOp/CppInterOp.h 95.55% <ø> (ø)
lib/CppInterOp/CppInterOp.cpp 88.67% <94.73%> (-0.13%) ⬇️
lib/CppInterOp/Compatibility.h 77.53% <58.62%> (-14.50%) ⬇️
lib/CppInterOp/CppInterOpInterpreter.h 83.89% <67.39%> (-4.19%) ⬇️
🚀 New features to boost your workflow:

The tests are not covering over 1/4 of this patch. @kr-2003 can you improve the coverage?

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

std::string(LLVM_BUILD_LIB_DIR) + "/bin/llvm-jitlink-executor";
OutOfProcessConfig.UseSharedMemory = false;
OutOfProcessConfig.SlabAllocateSize = 0;
// LCOV_EXCL_START
Copy link
Collaborator

@mcbarton mcbarton Oct 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LCOV_EXCL_START and LCOV_EXCL_STOP are things I think we should not be using. If something is not being covered, we need to know. Then we can make an informed decision if its not something expected to be covered. Excluding sections from the report is a bad idea.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't test out this lambda. this block is run in the child process of oop interpreter. that's why ignored it during the coverage.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not comfortable with LCOV_EXCL_START. We will end up ignoring it forever. But maybe tomorrow, there is a way to test it.
cc @vgvassilev

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am removing the comments. I realised that it's not good practice to ignore the coverage.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

// Use interpreter-managed redirection file for out-of-process stdout
FILE* redirected = I.getRedirectionFileForOutOfProcess(FD);
if (redirected) {
m_TempFile.release(); // release ownership of current tmpfile
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: the value returned by this function should not be disregarded; neglecting it may lead to errors [bugprone-unused-return-value]

        m_TempFile.release(); // release ownership of current tmpfile
        ^

m_OwnsFile = false;
}
} else {
m_TempFile.reset(tmpfile());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: initializing non-owner argument of type 'pointer' (aka '_IO_FILE *') with a newly created 'gsl::owner<>' [cppcoreguidelines-owning-memory]

      m_TempFile.reset(tmpfile());
                       ^

std::string(LLVM_BUILD_LIB_DIR) + "/bin/llvm-jitlink-executor";
OutOfProcessConfig.UseSharedMemory = false;
OutOfProcessConfig.SlabAllocateSize = 0;
// LCOV_EXCL_START
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not comfortable with LCOV_EXCL_START. We will end up ignoring it forever. But maybe tomorrow, there is a way to test it.
cc @vgvassilev

Comment on lines 275 to 276
OutOfProcessConfig.OOPExecutor =
std::string(LLVM_SOURCE_DIR) + "/build/bin/llvm-jitlink-executor";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Example:

#define Stringify(s) Stringifyx(s)
#define Stringifyx(...) #__VA_ARGS__

#define VERSION "1.0.2"
#define VERSION_NUM 1
#define LLVM_PATH "asasa/"

std::string final_str = "/asasa/" Stringify(VERSION_NUM) "/" LLVM_PATH;

StreamCaptureInfo(int FD) : m_FD(FD) {
#if !defined(CPPINTEROP_USE_CLING) && !defined(_WIN32)
auto& I = getInterp(NULLPTR);
if (I.isOutOfProcess() && FD == STDOUT_FILENO) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still don't understand why we don't do this for stderr?


int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
parseCustomArguments(argc, argv);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need custom arguments as we discussed -- this should be a property of the test fixture and TestUtils::CreateInterpreter.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, ran tests two times here in the main only. First one in-process and other one as out-of-process(conditional check with LLVM_BUILT_WITH_JIT_OOP compiled time var).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Therefore no need of passing use-oop-jit flag in test binary.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

#include <unistd.h>
#endif
#include <unordered_map>
#include <utility>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: included header unordered_map is not used directly [misc-include-cleaner]

Suggested change
#include <utility>
#include <utility>

Comment on lines 283 to 284
OutOfProcessConfig.CustomizeFork = [&stdin_fd, &stdout_fd,
&stderr_fd]() { // Lambda defined inline
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
OutOfProcessConfig.CustomizeFork = [&stdin_fd, &stdout_fd,
&stderr_fd]() { // Lambda defined inline
OutOfProcessConfig.CustomizeFork = [stdin_fd, stdout_fd,
stderr_fd]() { // Lambda defined inline

Should be captured by value here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Interp->process(R"(
#include <stdio.h>
printf("%s\n", "Hello World");
fflush(stdout);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to remove this fflush from the user code? And we do this ourselves in the StreamCaptureInfo class?

Copy link
Collaborator

@Vipul-Cariappa Vipul-Cariappa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few comments. I guess everything else is fine. Please also look at the github-actions's comments.

Comment on lines 4135 to 4139
#ifdef LLVM_BUILT_WITH_OOP_JIT
auto& I = getInterp();
return I.getOutOfProcessExecutorPID();
#endif
return 0;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change to

if (running_in_oop)
  return I.getOutOfProcessExecutorPID();
return getpid();

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment on lines 173 to 175
static std::tuple<int, int, int, bool>
getFileDescriptorsForOutOfProcess(std::vector<const char*>& vargs,
std::unique_ptr<IOContext>& io_ctx) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
static std::tuple<int, int, int, bool>
getFileDescriptorsForOutOfProcess(std::vector<const char*>& vargs,
std::unique_ptr<IOContext>& io_ctx) {
static std::tuple<int, int, int>
initAndGetFile(std::vector<const char*>& vargs,
std::unique_ptr<IOContext>& io_ctx) {

return -1, -1, -1 if temp file creation fail.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of returning -1's, I have return 0, 1, 2 because i am falling back to in-process if out-of-process fails

Comment on lines 215 to 217
Interpreter(std::unique_ptr<clang::Interpreter> CI,
std::unique_ptr<IOContext> ctx = nullptr)
: inner(std::move(CI)), io_context(std::move(ctx)), outOfProcess(false) {}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Interpreter(std::unique_ptr<clang::Interpreter> CI,
std::unique_ptr<IOContext> ctx = nullptr)
: inner(std::move(CI)), io_context(std::move(ctx)), outOfProcess(false) {}
Interpreter(std::unique_ptr<clang::Interpreter> CI,
std::unique_ptr<IOContext> ctx = nullptr, bool oop = false)
: inner(std::move(CI)), io_context(std::move(ctx)), outOfProcess(false) {}

and remove the other constructor.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment on lines 1453 to 1455
if (TestUtils::use_oop_jit()) {
GTEST_SKIP() << "Test fails for OOP JIT builds";
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (TestUtils::use_oop_jit()) {
GTEST_SKIP() << "Test fails for OOP JIT builds";
}
if (TestUtils::use_oop_jit())
GTEST_SKIP() << "Test fails for OOP JIT builds";

apply everywhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment on lines 22 to 25
bool& TestUtils::use_oop_jit() {
static bool flag = false;
return flag;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this should not return a reference.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, declared an extern variable called use_oop_jit in TestUtils namespace and used it everywhere.

return false;
#endif
if (!Cpp::CreateInterpreter({}, {"--cuda"}))
if (!TestUtils::CreateInterpreter({}, {"--cuda"}))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets not use OOP-JIT for CUDA now.

Suggested change
if (!TestUtils::CreateInterpreter({}, {"--cuda"}))
if (!Cpp::CreateInterpreter({}, {"--cuda"}))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

size_t newLen =
fread(content.get(), sizeof(char), bufsize, m_TempFile.get());
if (ferror(m_TempFile.get()) != 0)
size_t newLen = fread(content.get(), sizeof(char), bufsize, m_TempFile);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: The 1st argument to 'fread' is a buffer with size 0 but should be a buffer with size equal to or greater than the value of the 2nd argument (which is 1) times the 3rd argument (which is 18446744073709551615) [clang-analyzer-unix.StdCLibraryFunctions]

    size_t newLen = fread(content.get(), sizeof(char), bufsize, m_TempFile);
                    ^
Additional context

lib/CppInterOp/CppInterOp.cpp:4104: Calling 'StreamCaptureInfo::GetCapturedString'

  std::string result = SCI.GetCapturedString();
                       ^

lib/CppInterOp/CppInterOp.cpp:4050: Taking false branch

    if (dup2(m_DupFD, m_FD) < 0)
    ^

lib/CppInterOp/CppInterOp.cpp:4053: Taking false branch

    if (fseek(m_TempFile, 0L, SEEK_END) != 0)
    ^

lib/CppInterOp/CppInterOp.cpp:4057: Assuming that 'ftell' fails

    long bufsize = ftell(m_TempFile);
                   ^

lib/CppInterOp/CppInterOp.cpp:4057: 'bufsize' initialized here

    long bufsize = ftell(m_TempFile);
    ^

lib/CppInterOp/CppInterOp.cpp:4058: Taking true branch

    if (bufsize == -1)
    ^

lib/CppInterOp/CppInterOp.cpp:4062: Storing uninitialized value

    std::unique_ptr<char[]> content(new char[bufsize + 1]);
                                    ^

lib/CppInterOp/CppInterOp.cpp:4062: Passing value via 1st parameter '__p'

    std::unique_ptr<char[]> content(new char[bufsize + 1]);
                                    ^

lib/CppInterOp/CppInterOp.cpp:4062: Calling constructor for 'unique_ptr<char[], std::default_delete<char[]>>'

    std::unique_ptr<char[]> content(new char[bufsize + 1]);
                            ^

/usr/include/c++/13/bits/unique_ptr.h:603: Calling constructor for '__uniq_ptr_data<char, std::default_delete<char[]>, true, true>'

	: _M_t(__p)
   ^

/usr/include/c++/13/bits/unique_ptr.h:603: Passing '' via 1st parameter '__p'

	: _M_t(__p)
        ^

/usr/include/c++/13/bits/unique_ptr.h:603: Calling constructor for '__uniq_ptr_impl<char, std::default_delete<char[]>>'

	: _M_t(__p)
   ^

/usr/include/c++/13/bits/unique_ptr.h:175: Calling '__uniq_ptr_impl::_M_ptr'

      __uniq_ptr_impl(pointer __p) : _M_t() { _M_ptr() = __p; }
                                              ^

/usr/include/c++/13/bits/unique_ptr.h:196: Calling 'get<0UL, char *, std::default_delete<char[]>>'

      pointer&   _M_ptr() noexcept { return std::get<0>(_M_t); }
                                            ^

/usr/include/c++/13/tuple:1803: Calling '__get_helper<0UL, char *, std::default_delete<char[]>>'

    { return std::__get_helper<__i>(__t); }
             ^

/usr/include/c++/13/tuple:1787: Calling '_Tuple_impl::_M_head'

    { return _Tuple_impl<__i, _Head, _Tail...>::_M_head(__t); }
             ^

/usr/include/c++/13/tuple:268: Calling '_Head_base::_M_head'

      _M_head(_Tuple_impl& __t) noexcept { return _Base::_M_head(__t); }
                                                  ^

/usr/include/c++/13/tuple:268: Returning from '_Head_base::_M_head'

      _M_head(_Tuple_impl& __t) noexcept { return _Base::_M_head(__t); }
                                                  ^

/usr/include/c++/13/tuple:1787: Returning from '_Tuple_impl::_M_head'

    { return _Tuple_impl<__i, _Head, _Tail...>::_M_head(__t); }
             ^

/usr/include/c++/13/tuple:1803: Returning from '__get_helper<0UL, char *, std::default_delete<char[]>>'

    { return std::__get_helper<__i>(__t); }
             ^

/usr/include/c++/13/bits/unique_ptr.h:196: Returning from 'get<0UL, char *, std::default_delete<char[]>>'

      pointer&   _M_ptr() noexcept { return std::get<0>(_M_t); }
                                            ^

/usr/include/c++/13/bits/unique_ptr.h:175: Returning from '__uniq_ptr_impl::_M_ptr'

      __uniq_ptr_impl(pointer __p) : _M_t() { _M_ptr() = __p; }
                                              ^

/usr/include/c++/13/bits/unique_ptr.h:175: The value of '__p' is assigned to 'content._M_t._M_t._M_head_impl'

      __uniq_ptr_impl(pointer __p) : _M_t() { _M_ptr() = __p; }
                                              ^

/usr/include/c++/13/bits/unique_ptr.h:603: Returning from constructor for '__uniq_ptr_impl<char, std::default_delete<char[]>>'

	: _M_t(__p)
   ^

/usr/include/c++/13/bits/unique_ptr.h:603: Returning from constructor for '__uniq_ptr_data<char, std::default_delete<char[]>, true, true>'

	: _M_t(__p)
   ^

lib/CppInterOp/CppInterOp.cpp:4062: Returning from constructor for 'unique_ptr<char[], std::default_delete<char[]>>'

    std::unique_ptr<char[]> content(new char[bufsize + 1]);
                            ^

lib/CppInterOp/CppInterOp.cpp:4065: Taking false branch

    if (fseek(m_TempFile, 0L, SEEK_SET) != 0)
    ^

lib/CppInterOp/CppInterOp.cpp:4069: The 1st argument to 'fread' is a buffer with size 0 but should be a buffer with size equal to or greater than the value of the 2nd argument (which is 1) times the 3rd argument (which is 18446744073709551615)

    size_t newLen = fread(content.get(), sizeof(char), bufsize, m_TempFile);
                    ^

}

#ifndef _WIN32
[[nodiscard]] pid_t getOutOfProcessExecutorPID() const {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: method 'getOutOfProcessExecutorPID' can be made static [readability-convert-member-functions-to-static]

Suggested change
[[nodiscard]] pid_t getOutOfProcessExecutorPID() const {
[[nodiscard]] static pid_t getOutOfProcessExecutorPID() {

}

#ifndef _WIN32
[[nodiscard]] pid_t getOutOfProcessExecutorPID() const {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "pid_t" is directly included [misc-include-cleaner]

lib/CppInterOp/CppInterOpInterpreter.h:25:

- #if CLANG_VERSION_MAJOR >= 19
+ #include <sched.h>
+ #if CLANG_VERSION_MAJOR >= 19

using namespace llvm;

namespace TestUtils {
bool use_oop_jit = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'use_oop_jit' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables]

bool use_oop_jit = false;
     ^

}
#define Interp (static_cast<compat::Interpreter*>(Cpp::GetInterpreter()))
namespace TestUtils {
extern bool use_oop_jit;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'use_oop_jit' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables]

extern bool use_oop_jit;
            ^

@@ -1,6 +1,16 @@
#include "Utils.h"
#include <gtest/gtest.h>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: included header Utils.h is not used directly [misc-include-cleaner]

Suggested change
#include <gtest/gtest.h>
#include <gtest/gtest.h>

#include "Utils.h"
#include <gtest/gtest.h>
#include <string>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: included header string is not used directly [misc-include-cleaner]

Suggested change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants