Skip to content

Conversation

@aaronj0
Copy link
Collaborator

@aaronj0 aaronj0 commented Oct 1, 2025

Registering this runtime symbol fixes JIT session errors when calling Cpp::Evaluate if the process does not see symbols from libClangCppInterOp.so.

@aaronj0 aaronj0 requested a review from vgvassilev October 1, 2025 11:41
@aaronj0 aaronj0 force-pushed the register-runtime-symbols branch from 7ab924a to b912765 Compare October 1, 2025 11:49
@codecov
Copy link

codecov bot commented Oct 1, 2025

Codecov Report

❌ Patch coverage is 88.88889% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.09%. Comparing base (dbf6317) to head (ecb9bb6).
⚠️ Report is 3 commits behind head on main.

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

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #726      +/-   ##
==========================================
+ Coverage   79.04%   79.09%   +0.04%     
==========================================
  Files           9        9              
  Lines        3880     3898      +18     
==========================================
+ Hits         3067     3083      +16     
- Misses        813      815       +2     
Files with missing lines Coverage Δ
lib/CppInterOp/CppInterOp.cpp 87.62% <88.88%> (+0.01%) ⬆️
Files with missing lines Coverage Δ
lib/CppInterOp/CppInterOp.cpp 87.62% <88.88%> (+0.01%) ⬆️
🚀 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

#include <unistd.h>
#endif // WIN32

extern "C" void __clang_Interpreter_SetValueNoAlloc(void* This, void* OutVal,
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: declaration uses identifier '__clang_Interpreter_SetValueNoAlloc', which is a reserved identifier [bugprone-reserved-identifier]

extern "C" void __clang_Interpreter_SetValueNoAlloc(void* This, void* OutVal,
                ^

this fix will not be applied because it overlaps with another fix

#include <unistd.h>
#endif // WIN32

extern "C" void __clang_Interpreter_SetValueNoAlloc(void* This, void* OutVal,
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: invalid case style for function '__clang_Interpreter_SetValueNoAlloc' [readability-identifier-naming]

extern "C" void __clang_Interpreter_SetValueNoAlloc(void* This, void* OutVal,
                ^

this fix will not be applied because it overlaps with another fix

#ifndef CPPINTEROP_USE_CLING
static bool DefineAbsoluteSymbol(compat::Interpreter& I,
const char* linker_mangled_name,
uint64_t address) {
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 "uint64_t" is directly included [misc-include-cleaner]

                                 uint64_t address) {
                                 ^

JITDylib& DyLib = *Jit.getProcessSymbolsJITDylib().get();

llvm::orc::SymbolMap InjectedSymbols;
auto& DL = compat::getExecutionEngine(I)->getDataLayout();
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 &DL' can be declared as 'const auto &DL' [readability-qualified-auto]

Suggested change
auto& DL = compat::getExecutionEngine(I)->getDataLayout();
const auto& DL = compat::getExecutionEngine(I)->getDataLayout();

// define __clang_Interpreter_SetValueNoAlloc in the JIT dylib for clang-repl
#ifndef CPPINTEROP_USE_CLING
DefineAbsoluteSymbol(*I, "__clang_Interpreter_SetValueNoAlloc",
(uint64_t)&__clang_Interpreter_SetValueNoAlloc);
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]

                       (uint64_t)&__clang_Interpreter_SetValueNoAlloc);
                       ^

@aaronj0 aaronj0 force-pushed the register-runtime-symbols branch from d7da73e to 9c6be69 Compare October 1, 2025 12:46
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

extern "C" void* __clang_Interpreter_SetValueWithAlloc(void* This, void* OutVal,
void* OpaqueType)
#else
void* __clang_Interpreter_SetValueWithAlloc(void* This, void* OutVal,
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: declaration uses identifier '__clang_Interpreter_SetValueWithAlloc', which is a reserved identifier [bugprone-reserved-identifier]

void* __clang_Interpreter_SetValueWithAlloc(void* This, void* OutVal,
      ^

this fix will not be applied because it overlaps with another fix

extern "C" void* __clang_Interpreter_SetValueWithAlloc(void* This, void* OutVal,
void* OpaqueType)
#else
void* __clang_Interpreter_SetValueWithAlloc(void* This, void* OutVal,
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 '__clang_Interpreter_SetValueWithAlloc' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage]

Suggested change
void* __clang_Interpreter_SetValueWithAlloc(void* This, void* OutVal,
static void* __clang_Interpreter_SetValueWithAlloc(void* This, void* OutVal,

extern "C" void* __clang_Interpreter_SetValueWithAlloc(void* This, void* OutVal,
void* OpaqueType)
#else
void* __clang_Interpreter_SetValueWithAlloc(void* This, void* OutVal,
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: invalid case style for function '__clang_Interpreter_SetValueWithAlloc' [readability-identifier-naming]

void* __clang_Interpreter_SetValueWithAlloc(void* This, void* OutVal,
      ^

this fix will not be applied because it overlaps with another fix

void* OpaqueType);
#endif

extern "C" void __clang_Interpreter_SetValueNoAlloc(void* This,
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: declaration uses identifier '__clang_Interpreter_SetValueNoAlloc', which is a reserved identifier [bugprone-reserved-identifier]

    extern "C" void __clang_Interpreter_SetValueNoAlloc(void* This,
                    ^

this fix will not be applied because it overlaps with another fix

void* OpaqueType);
#endif

extern "C" void __clang_Interpreter_SetValueNoAlloc(void* This,
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: invalid case style for function '__clang_Interpreter_SetValueNoAlloc' [readability-identifier-naming]

    extern "C" void __clang_Interpreter_SetValueNoAlloc(void* This,
                    ^

this fix will not be applied because it overlaps with another fix

std::string mangledName;
compat::maybeMangleDeclName(GD, mangledName);
DefineAbsoluteSymbol(*I, mangledName.c_str(),
(uint64_t)&__clang_Interpreter_SetValueWithAlloc);
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]

                         (uint64_t)&__clang_Interpreter_SetValueWithAlloc);
                         ^

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

#endif

#if CLANG_VERSION_MAJOR >= 19
extern "C" void __clang_Interpreter_SetValueNoAlloc(void* This,
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: declaration uses identifier '__clang_Interpreter_SetValueNoAlloc', which is a reserved identifier [bugprone-reserved-identifier]

extern "C" void __clang_Interpreter_SetValueNoAlloc(void* This,
                ^

this fix will not be applied because it overlaps with another fix

#endif

#if CLANG_VERSION_MAJOR >= 19
extern "C" void __clang_Interpreter_SetValueNoAlloc(void* This,
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: invalid case style for function '__clang_Interpreter_SetValueNoAlloc' [readability-identifier-naming]

extern "C" void __clang_Interpreter_SetValueNoAlloc(void* This,
                ^

this fix will not be applied because it overlaps with another fix

}
#else
DefineAbsoluteSymbol(*I, "__clang_Interpreter_SetValueNoAlloc",
(uint64_t)&__clang_Interpreter_SetValueNoAlloc);
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]

(uint64_t)&__clang_Interpreter_SetValueNoAlloc);
^

@aaronj0 aaronj0 force-pushed the register-runtime-symbols branch from fdffc1d to 740bcb3 Compare October 3, 2025 14:10
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

#endif

#if CLANG_VERSION_MAJOR >= 19
extern "C" void __clang_Interpreter_SetValueNoAlloc(void* This,
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: declaration uses identifier '__clang_Interpreter_SetValueNoAlloc', which is a reserved identifier [bugprone-reserved-identifier]

    extern "C" void __clang_Interpreter_SetValueNoAlloc(void* This,
                    ^

this fix will not be applied because it overlaps with another fix

#endif

#if CLANG_VERSION_MAJOR >= 19
extern "C" void __clang_Interpreter_SetValueNoAlloc(void* This,
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: invalid case style for function '__clang_Interpreter_SetValueNoAlloc' [readability-identifier-naming]

    extern "C" void __clang_Interpreter_SetValueNoAlloc(void* This,
                    ^

this fix will not be applied because it overlaps with another fix

}
#else
DefineAbsoluteSymbol(*I, "__clang_Interpreter_SetValueNoAlloc",
(uint64_t)&__clang_Interpreter_SetValueNoAlloc);
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]

                       (uint64_t)&__clang_Interpreter_SetValueNoAlloc);
                       ^

@aaronj0 aaronj0 force-pushed the register-runtime-symbols branch from aadc275 to 4ef7df9 Compare October 3, 2025 15:05
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

// Runtime symbols required if the library using JIT (Cpp::Evaluate) does not
// link to llvm
#if !defined(CPPINTEROP_USE_CLING) && !defined(EMSCRIPTEN)
struct __clang_Interpreter_NewTag {} __ci_newtag;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: declaration uses identifier '__ci_newtag', which is a reserved identifier [bugprone-reserved-identifier]

struct __clang_Interpreter_NewTag {} __ci_newtag;
                                     ^

this fix will not be applied because it overlaps with another fix

// Runtime symbols required if the library using JIT (Cpp::Evaluate) does not
// link to llvm
#if !defined(CPPINTEROP_USE_CLING) && !defined(EMSCRIPTEN)
struct __clang_Interpreter_NewTag {} __ci_newtag;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: declaration uses identifier '__clang_Interpreter_NewTag', which is a reserved identifier [bugprone-reserved-identifier]

struct __clang_Interpreter_NewTag {} __ci_newtag;
       ^

this fix will not be applied because it overlaps with another fix

// Runtime symbols required if the library using JIT (Cpp::Evaluate) does not
// link to llvm
#if !defined(CPPINTEROP_USE_CLING) && !defined(EMSCRIPTEN)
struct __clang_Interpreter_NewTag {} __ci_newtag;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: invalid case style for class '__clang_Interpreter_NewTag' [readability-identifier-naming]

struct __clang_Interpreter_NewTag {} __ci_newtag;
       ^

this fix will not be applied because it overlaps with another fix

// Runtime symbols required if the library using JIT (Cpp::Evaluate) does not
// link to llvm
#if !defined(CPPINTEROP_USE_CLING) && !defined(EMSCRIPTEN)
struct __clang_Interpreter_NewTag {} __ci_newtag;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: invalid case style for variable '__ci_newtag' [readability-identifier-naming]

struct __clang_Interpreter_NewTag {} __ci_newtag;
                                     ^

this fix will not be applied because it overlaps with another fix

// Runtime symbols required if the library using JIT (Cpp::Evaluate) does not
// link to llvm
#if !defined(CPPINTEROP_USE_CLING) && !defined(EMSCRIPTEN)
struct __clang_Interpreter_NewTag {} __ci_newtag;
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 '__ci_newtag' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables]

struct __clang_Interpreter_NewTag {} __ci_newtag;
                                     ^


// Define runtime symbols in the JIT dylib for clang-repl
#if !defined(CPPINTEROP_USE_CLING) && !defined(EMSCRIPTEN)
DefineAbsoluteSymbol(*I, "__ci_newtag", (uint64_t)&__ci_newtag);
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]

  DefineAbsoluteSymbol(*I, "__ci_newtag", (uint64_t)&__ci_newtag);
                                          ^

@aaronj0 aaronj0 force-pushed the register-runtime-symbols branch 2 times, most recently from b45c436 to 8d91bcd Compare October 3, 2025 16:13
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

// Runtime symbols required if the library using JIT (Cpp::Evaluate) does not
// link to llvm
#if !defined(CPPINTEROP_USE_CLING) && !defined(EMSCRIPTEN)
struct __clang_Interpreter_NewTag {
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: invalid case style for class '__clang_Interpreter_NewTag' [readability-identifier-naming]

struct __clang_Interpreter_NewTag {
       ^

this fix will not be applied because it overlaps with another fix

Copy link
Contributor

Choose a reason for hiding this comment

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

We should add the relevant clang-tidy suppression.

@mcbarton
Copy link
Collaborator

mcbarton commented Oct 5, 2025

Codecov Report

❌ Patch coverage is 89.28571% with 3 lines in your changes missing coverage. Please review. ✅ Project coverage is 81.11%. Comparing base (bcde755) to head (8d91bcd). ⚠️ Report is 3 commits behind head on main.
Files with missing lines Patch % Lines
lib/CppInterOp/CppInterOp.cpp 89.28% 3 Missing ⚠️
Additional details and impacted files

🚀 New features to boost your workflow:

Can you expand the test to cover the 3 lines not currently covered?

@aaronj0 aaronj0 force-pushed the register-runtime-symbols branch from 7412591 to 409f115 Compare October 6, 2025 09:22
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

// Runtime symbols required if the library using JIT (Cpp::Evaluate) does not
// link to llvm
#if !defined(CPPINTEROP_USE_CLING) && !defined(EMSCRIPTEN)
struct __clang_Interpreter_NewTag {
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: declaration uses identifier '__clang_Interpreter_NewTag', which is a reserved identifier [bugprone-reserved-identifier]

struct __clang_Interpreter_NewTag {
       ^

this fix will not be applied because it overlaps with another fix

// Runtime symbols required if the library using JIT (Cpp::Evaluate) does not
// link to llvm
#if !defined(CPPINTEROP_USE_CLING) && !defined(EMSCRIPTEN)
struct __clang_Interpreter_NewTag {
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: invalid case style for class '__clang_Interpreter_NewTag' [readability-identifier-naming]

struct __clang_Interpreter_NewTag {
       ^

this fix will not be applied because it overlaps with another fix

// link to llvm
#if !defined(CPPINTEROP_USE_CLING) && !defined(EMSCRIPTEN)
struct __clang_Interpreter_NewTag {
} __ci_newtag;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: declaration uses identifier '__ci_newtag', which is a reserved identifier [bugprone-reserved-identifier]

} __ci_newtag;
  ^

this fix will not be applied because it overlaps with another fix

// link to llvm
#if !defined(CPPINTEROP_USE_CLING) && !defined(EMSCRIPTEN)
struct __clang_Interpreter_NewTag {
} __ci_newtag;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: invalid case style for variable '__ci_newtag' [readability-identifier-naming]

} __ci_newtag;
  ^

this fix will not be applied because it overlaps with another fix

// link to llvm
#if !defined(CPPINTEROP_USE_CLING) && !defined(EMSCRIPTEN)
struct __clang_Interpreter_NewTag {
} __ci_newtag;
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 '__ci_newtag' defined in a header file; variable definitions in header files can lead to ODR violations [misc-definitions-in-headers]

} __ci_newtag;
  ^

// link to llvm
#if !defined(CPPINTEROP_USE_CLING) && !defined(EMSCRIPTEN)
struct __clang_Interpreter_NewTag {
} __ci_newtag;
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 '__ci_newtag' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables]

} __ci_newtag;
  ^

extern "C" void* __clang_Interpreter_SetValueWithAlloc(void* This, void* OutVal,
void* OpaqueType)
#else
void* __clang_Interpreter_SetValueWithAlloc(void* This, void* OutVal,
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: declaration uses identifier '__clang_Interpreter_SetValueWithAlloc', which is a reserved identifier [bugprone-reserved-identifier]

void* __clang_Interpreter_SetValueWithAlloc(void* This, void* OutVal,
      ^

this fix will not be applied because it overlaps with another fix

extern "C" void* __clang_Interpreter_SetValueWithAlloc(void* This, void* OutVal,
void* OpaqueType)
#else
void* __clang_Interpreter_SetValueWithAlloc(void* This, void* OutVal,
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: invalid case style for function '__clang_Interpreter_SetValueWithAlloc' [readability-identifier-naming]

void* __clang_Interpreter_SetValueWithAlloc(void* This, void* OutVal,
      ^

this fix will not be applied because it overlaps with another fix

#endif

#if CLANG_VERSION_MAJOR > 18
extern "C" void __clang_Interpreter_SetValueNoAlloc(void* This,
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: declaration uses identifier '__clang_Interpreter_SetValueNoAlloc', which is a reserved identifier [bugprone-reserved-identifier]

    extern "C" void __clang_Interpreter_SetValueNoAlloc(void* This,
                    ^

this fix will not be applied because it overlaps with another fix

#endif

#if CLANG_VERSION_MAJOR > 18
extern "C" void __clang_Interpreter_SetValueNoAlloc(void* This,
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: invalid case style for function '__clang_Interpreter_SetValueNoAlloc' [readability-identifier-naming]

    extern "C" void __clang_Interpreter_SetValueNoAlloc(void* This,
                    ^

this fix will not be applied because it overlaps with another fix

@aaronj0 aaronj0 force-pushed the register-runtime-symbols branch 2 times, most recently from 1eabe0c to e15be64 Compare October 6, 2025 10:23
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

@aaronj0 aaronj0 force-pushed the register-runtime-symbols branch from e15be64 to 3c17a65 Compare October 10, 2025 09:13
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
Collaborator

@mcbarton mcbarton left a comment

Choose a reason for hiding this comment

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

@aaronj0 aaronj0 force-pushed the register-runtime-symbols branch from 3c17a65 to 708d0dd Compare October 27, 2025 14:58
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

// link to llvm
#if !defined(CPPINTEROP_USE_CLING) && !defined(EMSCRIPTEN)
struct __clang_Interpreter_NewTag {
} __ci_newtag;
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 '__ci_newtag' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage]

lib/CppInterOp/CppInterOp.cpp:91:

- struct __clang_Interpreter_NewTag {
+ static struct __clang_Interpreter_NewTag {

@aaronj0 aaronj0 force-pushed the register-runtime-symbols branch from 708d0dd to 9000c0a Compare December 3, 2025 14:54
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

// link to llvm
#if !defined(CPPINTEROP_USE_CLING) && !defined(EMSCRIPTEN)
struct __clang_Interpreter_NewTag {
} __ci_newtag;
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 '__ci_newtag' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage]

lib/CppInterOp/CppInterOp.cpp:96:

- struct __clang_Interpreter_NewTag {
+ static struct __clang_Interpreter_NewTag {

@aaronj0 aaronj0 force-pushed the register-runtime-symbols branch from 9000c0a to 79c27c8 Compare December 3, 2025 15:16
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

// Define runtime symbols in the JIT dylib for clang-repl
#if !defined(CPPINTEROP_USE_CLING) && !defined(EMSCRIPTEN)
DefineAbsoluteSymbol(*I, "__ci_newtag",
reinterpret_cast<uint64_t>(&__ci_newtag));
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 reinterpret_cast [cppcoreguidelines-pro-type-reinterpret-cast]

                       reinterpret_cast<uint64_t>(&__ci_newtag));
                       ^

compat::maybeMangleDeclName(GD, mangledName);
DefineAbsoluteSymbol(
*I, mangledName.c_str(),
reinterpret_cast<uint64_t>(&__clang_Interpreter_SetValueWithAlloc));
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 reinterpret_cast [cppcoreguidelines-pro-type-reinterpret-cast]

        reinterpret_cast<uint64_t>(&__clang_Interpreter_SetValueWithAlloc));
        ^

#else
DefineAbsoluteSymbol(
*I, "__clang_Interpreter_SetValueNoAlloc",
reinterpret_cast<uint64_t>(&__clang_Interpreter_SetValueNoAlloc));
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 reinterpret_cast [cppcoreguidelines-pro-type-reinterpret-cast]

      reinterpret_cast<uint64_t>(&__clang_Interpreter_SetValueNoAlloc));
      ^

@aaronj0 aaronj0 force-pushed the register-runtime-symbols branch from 79c27c8 to 671ffd3 Compare December 3, 2025 15:43
@aaronj0 aaronj0 dismissed mcbarton’s stale review December 3, 2025 15:44

The requested changes were addressed

@aaronj0 aaronj0 force-pushed the register-runtime-symbols branch from 671ffd3 to 4f22479 Compare December 3, 2025 16:10
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

// link to llvm
#if !defined(CPPINTEROP_USE_CLING) && !defined(EMSCRIPTEN)
struct __clang_Interpreter_NewTag {
} __ci_newtag;
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 '__ci_newtag' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage]

lib/CppInterOp/CppInterOp.cpp:100:

- struct __clang_Interpreter_NewTag {
+ static struct __clang_Interpreter_NewTag {

@aaronj0 aaronj0 force-pushed the register-runtime-symbols branch from 4f22479 to e055c14 Compare December 3, 2025 16:51
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

// link to llvm
#if !defined(CPPINTEROP_USE_CLING) && !defined(EMSCRIPTEN)
struct __clang_Interpreter_NewTag {
} __ci_newtag;
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 '__ci_newtag' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage]

lib/CppInterOp/CppInterOp.cpp:102:

- struct __clang_Interpreter_NewTag {
+ static struct __clang_Interpreter_NewTag {

@aaronj0 aaronj0 force-pushed the register-runtime-symbols branch from e055c14 to 1d5675a Compare December 4, 2025 09:14
DefineAbsoluteSymbol(*I, "__ci_newtag",
reinterpret_cast<uint64_t>(&__ci_newtag));
// llvm > 22 has this defined as a C symbol that does not require mangling
#if CLANG_VERSION_MAJOR >= 22
Copy link
Collaborator

@mcbarton mcbarton Dec 4, 2025

Choose a reason for hiding this comment

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

@aaronj0 It still feels very weird to have a reference to llvm 22 in the repo, before we even have llvm 21 support. If this needs to stay it should be consistent with the other reference to llvm 22 you make in this PR (e.g. #if CLANG_VERSION_MAJOR > 21).

As an aside, if you have managed to get CppInterOp working with llvm 21, do you know what is needed for MacOS to get this PR over the line #672 ? If yes, can you please apply a fix to the PR (I have enabled 'Allow edits and access to secrets by maintainers ')? If you don't know what is exactly causing the failure, but have an idea about what might fix the problem, still feel free to apply the attempted fix to the PR.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for the catch! I missed updating the max version here and it should match the #if CLANG_VERSION_MAJOR > 21 seen when declaring the symbols. That should work.

do you know what is needed for MacOS to get this PR over the line #672

I don't use Mac for development so I'm unaware of the issue you face in your PR.

If you don't know what is exactly causing the failure, but have an idea about what might fix the problem, still feel free to apply the attempted fix to the PR.

Unfortunately I won't have any free cycles until the EOY. If some time frees up then sure :)

@aaronj0 aaronj0 force-pushed the register-runtime-symbols branch from 1d5675a to ecb9bb6 Compare December 5, 2025 08:01
@aaronj0 aaronj0 requested a review from vgvassilev December 6, 2025 10:34
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!

@aaronj0 aaronj0 merged commit 935651b into compiler-research:main Dec 6, 2025
42 of 44 checks passed
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.

3 participants