|
86 | 86 | #include <unistd.h> |
87 | 87 | #endif // WIN32 |
88 | 88 |
|
89 | | -extern "C" void __clang_Interpreter_SetValueNoAlloc(void* This, void* OutVal, |
90 | | - void* OpaqueType, ...); |
| 89 | +#if CLANG_VERSION_MAJOR > 22 |
| 90 | +extern "C" void* __clang_Interpreter_SetValueWithAlloc(void* This, void* OutVal, |
| 91 | + void* OpaqueType) |
| 92 | +#else |
| 93 | +void* __clang_Interpreter_SetValueWithAlloc(void* This, void* OutVal, |
| 94 | + void* OpaqueType); |
| 95 | +#endif |
| 96 | + |
| 97 | + extern "C" void __clang_Interpreter_SetValueNoAlloc(void* This, |
| 98 | + void* OutVal, |
| 99 | + void* OpaqueType, ...); |
91 | 100 |
|
92 | 101 | namespace Cpp { |
93 | 102 |
|
@@ -3307,8 +3316,22 @@ TInterp_t CreateInterpreter(const std::vector<const char*>& Args /*={}*/, |
3307 | 3316 |
|
3308 | 3317 | sInterpreters->emplace_back(I, /*Owned=*/true); |
3309 | 3318 |
|
3310 | | -// define __clang_Interpreter_SetValueNoAlloc in the JIT dylib for clang-repl |
| 3319 | +// Define runtime symbols in the JIT dylib for clang-repl |
3311 | 3320 | #ifndef CPPINTEROP_USE_CLING |
| 3321 | +#if CLANG_VERSION_MAJOR > 22 |
| 3322 | + DefineAbsoluteSymbol(*I, "__clang_Interpreter_SetValueWithAlloc", |
| 3323 | + (uint64_t)&__clang_Interpreter_SetValueNoAlloc); |
| 3324 | +#else |
| 3325 | + auto* D = static_cast<clang::Decl*>( |
| 3326 | + Cpp::GetNamed("__clang_Interpreter_SetValueWithAlloc")); |
| 3327 | + if (auto* FD = llvm::dyn_cast<FunctionDecl>(D)) { |
| 3328 | + auto GD = GlobalDecl(FD); |
| 3329 | + std::string mangledName; |
| 3330 | + compat::maybeMangleDeclName(GD, mangledName); |
| 3331 | + DefineAbsoluteSymbol(*I, mangledName.c_str(), |
| 3332 | + (uint64_t)&__clang_Interpreter_SetValueWithAlloc); |
| 3333 | + } |
| 3334 | +#endif |
3312 | 3335 | DefineAbsoluteSymbol(*I, "__clang_Interpreter_SetValueNoAlloc", |
3313 | 3336 | (uint64_t)&__clang_Interpreter_SetValueNoAlloc); |
3314 | 3337 | #endif |
|
0 commit comments