Skip to content

Conversation

@Vipul-Cariappa
Copy link
Collaborator

To be merged later, after fixing stuff and performance.

@codecov
Copy link

codecov bot commented Oct 14, 2025

Codecov Report

❌ Patch coverage is 94.53125% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.83%. Comparing base (e1e07e0) to head (9368bb9).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
lib/CppInterOp/CppInterOp.cpp 94.53% 7 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #729      +/-   ##
==========================================
- Coverage   81.03%   79.83%   -1.21%     
==========================================
  Files           9        9              
  Lines        4214     3963     -251     
==========================================
- Hits         3415     3164     -251     
  Misses        799      799              
Files with missing lines Coverage Δ
include/CppInterOp/CppInterOp.h 95.55% <ø> (ø)
lib/CppInterOp/CppInterOpInterpreter.h 88.60% <ø> (+0.51%) ⬆️
lib/CppInterOp/CppInterOp.cpp 88.04% <94.53%> (-0.77%) ⬇️

... and 2 files with indirect coverage changes

Files with missing lines Coverage Δ
include/CppInterOp/CppInterOp.h 95.55% <ø> (ø)
lib/CppInterOp/CppInterOpInterpreter.h 88.60% <ø> (+0.51%) ⬆️
lib/CppInterOp/CppInterOp.cpp 88.04% <94.53%> (-0.77%) ⬇️

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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 21. Check the log or trigger a new build to see more.

return getInterpInfo(D).Interpreter->getSema();
}
static clang::Sema& getSema(const void* D) { return getInterp(D).getSema(); }
static llvm::ManagedStatic<std::deque<InterpreterInfo>> sInterpreters;
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 'sInterpreters' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables]

static llvm::ManagedStatic<std::deque<InterpreterInfo>> sInterpreters;
                                                        ^

return GetGlobalScope();

auto* ND = static_cast<NamedDecl*>(GetNamed(name, parent, interp));
auto* ND = (NamedDecl*)GetNamed(name, parent);
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: do not use C-style cast to convert between unrelated types [cppcoreguidelines-pro-type-cstyle-cast]

  auto* ND = (NamedDecl*)GetNamed(name, parent);
             ^

auto* Within = llvm::dyn_cast<clang::DeclContext>(D);
TCppScope_t GetNamed(const std::string& name,
TCppScope_t parent /*= nullptr*/) {
clang::DeclContext* Within = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: use nullptr [modernize-use-nullptr]

Suggested change
clang::DeclContext* Within = 0;
clang::DeclContext* Within = nullptr;

TCppScope_t parent /*= nullptr*/) {
clang::DeclContext* Within = 0;
if (parent) {
auto* D = (clang::Decl*)parent;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: do not use C-style cast to convert between unrelated types [cppcoreguidelines-pro-type-cstyle-cast]

    auto* D = (clang::Decl*)parent;
              ^

}

auto* ND = Cpp_utils::Lookup::Named(&getSema(D), name, Within);
auto* ND = Cpp_utils::Lookup::Named(&getSema(), name, Within);
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 "Cpp::utils::Lookup::Named" is directly included [misc-include-cleaner]

lib/CppInterOp/CppInterOp.cpp:12:

+ #include "CppInterOpInterpreter.h"

if (CXXRD->getNumBases() <= ibase)
return nullptr;
if (!CXXRD || CXXRD->getNumBases() <= ibase)
return 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: use nullptr [modernize-use-nullptr]

Suggested change
return 0;
return nullptr;


TCppType_t GetFunctionArgType(TCppFunction_t func, TCppIndex_t iarg) {
auto* D = static_cast<clang::Decl*>(func);
auto* D = (clang::Decl*)func;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: do not use C-style cast to convert between unrelated types [cppcoreguidelines-pro-type-cstyle-cast]

  auto* D = (clang::Decl*)func;
            ^

auto* Within = llvm::dyn_cast<DeclContext>(D);
LOCK(getInterpInfo(D));
bool ExistsFunctionTemplate(const std::string& name, TCppScope_t parent) {
DeclContext* Within = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: use nullptr [modernize-use-nullptr]

Suggested change
DeclContext* Within = 0;
DeclContext* Within = nullptr;

bool ExistsFunctionTemplate(const std::string& name, TCppScope_t parent) {
DeclContext* Within = 0;
if (parent) {
auto* D = (Decl*)parent;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: do not use C-style cast to convert between unrelated types [cppcoreguidelines-pro-type-cstyle-cast]

    auto* D = (Decl*)parent;
              ^

static TCppFuncAddr_t GetFunctionAddress(const FunctionDecl* FD) {
const auto get_mangled_name = [](const FunctionDecl* FD) {
auto* MangleCtxt = getASTContext(FD).createMangleContext();
auto MangleCtxt = getASTContext().createMangleContext();
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: 'auto MangleCtxt' can be declared as 'auto *MangleCtxt' [llvm-qualified-auto]

Suggested change
auto MangleCtxt = getASTContext().createMangleContext();
auto *MangleCtxt = getASTContext().createMangleContext();

Copy link
Contributor

@vgvassilev vgvassilev left a comment

Choose a reason for hiding this comment

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

LGTM. Having a TakeInterpreter interface outside of threading is useful I think.

@Vipul-Cariappa Vipul-Cariappa merged commit 1f43b4e into compiler-research:main Oct 15, 2025
56 of 58 checks passed
@Vipul-Cariappa Vipul-Cariappa deleted the revert/thread-safety branch October 15, 2025 13:12
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.

2 participants