-
Notifications
You must be signed in to change notification settings - Fork 39
[interp] Register runtime symbols for clang-repl #726
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[interp] Register runtime symbols for clang-repl #726
Conversation
7ab924a to
b912765
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ 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
🚀 New features to boost your workflow:
|
There was a problem hiding this 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
lib/CppInterOp/CppInterOp.cpp
Outdated
| #include <unistd.h> | ||
| #endif // WIN32 | ||
|
|
||
| extern "C" void __clang_Interpreter_SetValueNoAlloc(void* This, void* OutVal, |
There was a problem hiding this comment.
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
lib/CppInterOp/CppInterOp.cpp
Outdated
| #include <unistd.h> | ||
| #endif // WIN32 | ||
|
|
||
| extern "C" void __clang_Interpreter_SetValueNoAlloc(void* This, void* OutVal, |
There was a problem hiding this comment.
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
lib/CppInterOp/CppInterOp.cpp
Outdated
| #ifndef CPPINTEROP_USE_CLING | ||
| static bool DefineAbsoluteSymbol(compat::Interpreter& I, | ||
| const char* linker_mangled_name, | ||
| uint64_t address) { |
There was a problem hiding this comment.
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) {
^
lib/CppInterOp/CppInterOp.cpp
Outdated
| JITDylib& DyLib = *Jit.getProcessSymbolsJITDylib().get(); | ||
|
|
||
| llvm::orc::SymbolMap InjectedSymbols; | ||
| auto& DL = compat::getExecutionEngine(I)->getDataLayout(); |
There was a problem hiding this comment.
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]
| auto& DL = compat::getExecutionEngine(I)->getDataLayout(); | |
| const auto& DL = compat::getExecutionEngine(I)->getDataLayout(); |
lib/CppInterOp/CppInterOp.cpp
Outdated
| // 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); |
There was a problem hiding this comment.
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);
^d7da73e to
9c6be69
Compare
There was a problem hiding this 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, |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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]
| 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, |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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
lib/CppInterOp/CppInterOp.cpp
Outdated
| std::string mangledName; | ||
| compat::maybeMangleDeclName(GD, mangledName); | ||
| DefineAbsoluteSymbol(*I, mangledName.c_str(), | ||
| (uint64_t)&__clang_Interpreter_SetValueWithAlloc); |
There was a problem hiding this comment.
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);
^There was a problem hiding this 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
lib/CppInterOp/CppInterOp.cpp
Outdated
| #endif | ||
|
|
||
| #if CLANG_VERSION_MAJOR >= 19 | ||
| extern "C" void __clang_Interpreter_SetValueNoAlloc(void* This, |
There was a problem hiding this comment.
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
lib/CppInterOp/CppInterOp.cpp
Outdated
| #endif | ||
|
|
||
| #if CLANG_VERSION_MAJOR >= 19 | ||
| extern "C" void __clang_Interpreter_SetValueNoAlloc(void* This, |
There was a problem hiding this comment.
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
lib/CppInterOp/CppInterOp.cpp
Outdated
| } | ||
| #else | ||
| DefineAbsoluteSymbol(*I, "__clang_Interpreter_SetValueNoAlloc", | ||
| (uint64_t)&__clang_Interpreter_SetValueNoAlloc); |
There was a problem hiding this comment.
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);
^fdffc1d to
740bcb3
Compare
There was a problem hiding this 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, |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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
lib/CppInterOp/CppInterOp.cpp
Outdated
| } | ||
| #else | ||
| DefineAbsoluteSymbol(*I, "__clang_Interpreter_SetValueNoAlloc", | ||
| (uint64_t)&__clang_Interpreter_SetValueNoAlloc); |
There was a problem hiding this comment.
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);
^aadc275 to
4ef7df9
Compare
There was a problem hiding this 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
lib/CppInterOp/CppInterOp.cpp
Outdated
| // 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; |
There was a problem hiding this comment.
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
lib/CppInterOp/CppInterOp.cpp
Outdated
| // 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; |
There was a problem hiding this comment.
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
lib/CppInterOp/CppInterOp.cpp
Outdated
| // 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; |
There was a problem hiding this comment.
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
lib/CppInterOp/CppInterOp.cpp
Outdated
| // 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; |
There was a problem hiding this comment.
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
lib/CppInterOp/CppInterOp.cpp
Outdated
| // 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; |
There was a problem hiding this comment.
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;
^
lib/CppInterOp/CppInterOp.cpp
Outdated
|
|
||
| // 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); |
There was a problem hiding this comment.
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);
^b45c436 to
8d91bcd
Compare
There was a problem hiding this 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 { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
Can you expand the test to cover the 3 lines not currently covered? |
7412591 to
409f115
Compare
There was a problem hiding this 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
lib/CppInterOp/Compatibility.h
Outdated
| // 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 { |
There was a problem hiding this comment.
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
lib/CppInterOp/Compatibility.h
Outdated
| // 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 { |
There was a problem hiding this comment.
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
lib/CppInterOp/Compatibility.h
Outdated
| // link to llvm | ||
| #if !defined(CPPINTEROP_USE_CLING) && !defined(EMSCRIPTEN) | ||
| struct __clang_Interpreter_NewTag { | ||
| } __ci_newtag; |
There was a problem hiding this comment.
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
lib/CppInterOp/Compatibility.h
Outdated
| // link to llvm | ||
| #if !defined(CPPINTEROP_USE_CLING) && !defined(EMSCRIPTEN) | ||
| struct __clang_Interpreter_NewTag { | ||
| } __ci_newtag; |
There was a problem hiding this comment.
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
lib/CppInterOp/Compatibility.h
Outdated
| // link to llvm | ||
| #if !defined(CPPINTEROP_USE_CLING) && !defined(EMSCRIPTEN) | ||
| struct __clang_Interpreter_NewTag { | ||
| } __ci_newtag; |
There was a problem hiding this comment.
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;
^
lib/CppInterOp/Compatibility.h
Outdated
| // link to llvm | ||
| #if !defined(CPPINTEROP_USE_CLING) && !defined(EMSCRIPTEN) | ||
| struct __clang_Interpreter_NewTag { | ||
| } __ci_newtag; |
There was a problem hiding this comment.
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;
^
lib/CppInterOp/Compatibility.h
Outdated
| extern "C" void* __clang_Interpreter_SetValueWithAlloc(void* This, void* OutVal, | ||
| void* OpaqueType) | ||
| #else | ||
| void* __clang_Interpreter_SetValueWithAlloc(void* This, void* OutVal, |
There was a problem hiding this comment.
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
lib/CppInterOp/Compatibility.h
Outdated
| extern "C" void* __clang_Interpreter_SetValueWithAlloc(void* This, void* OutVal, | ||
| void* OpaqueType) | ||
| #else | ||
| void* __clang_Interpreter_SetValueWithAlloc(void* This, void* OutVal, |
There was a problem hiding this comment.
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
lib/CppInterOp/Compatibility.h
Outdated
| #endif | ||
|
|
||
| #if CLANG_VERSION_MAJOR > 18 | ||
| extern "C" void __clang_Interpreter_SetValueNoAlloc(void* This, |
There was a problem hiding this comment.
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
lib/CppInterOp/Compatibility.h
Outdated
| #endif | ||
|
|
||
| #if CLANG_VERSION_MAJOR > 18 | ||
| extern "C" void __clang_Interpreter_SetValueNoAlloc(void* This, |
There was a problem hiding this comment.
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
1eabe0c to
e15be64
Compare
There was a problem hiding this 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
e15be64 to
3c17a65
Compare
There was a problem hiding this 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
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See here for the change I am requesting https://github.com/compiler-research/CppInterOp/pull/726/files#r2404627401
3c17a65 to
708d0dd
Compare
There was a problem hiding this 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; |
There was a problem hiding this comment.
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 {708d0dd to
9000c0a
Compare
There was a problem hiding this 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; |
There was a problem hiding this comment.
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 {9000c0a to
79c27c8
Compare
There was a problem hiding this 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)); |
There was a problem hiding this comment.
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)); |
There was a problem hiding this comment.
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)); |
There was a problem hiding this comment.
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));
^79c27c8 to
671ffd3
Compare
The requested changes were addressed
671ffd3 to
4f22479
Compare
There was a problem hiding this 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; |
There was a problem hiding this comment.
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 {4f22479 to
e055c14
Compare
There was a problem hiding this 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; |
There was a problem hiding this comment.
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 {e055c14 to
1d5675a
Compare
lib/CppInterOp/CppInterOp.cpp
Outdated
| 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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 :)
1d5675a to
ecb9bb6
Compare
vgvassilev
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm!
Registering this runtime symbol fixes JIT session errors when calling
Cpp::Evaluateif the process does not see symbols fromlibClangCppInterOp.so.