|
90 | 90 | #include <unistd.h> |
91 | 91 | #endif // WIN32 |
92 | 92 |
|
93 | | -extern "C" void __clang_Interpreter_SetValueNoAlloc(void* This, void* OutVal, |
94 | | - void* OpaqueType, ...); |
| 93 | +#if CLANG_VERSION_MAJOR > 22 |
| 94 | +extern "C" void* __clang_Interpreter_SetValueWithAlloc(void* This, void* OutVal, |
| 95 | + void* OpaqueType) |
| 96 | +#else |
| 97 | +void* __clang_Interpreter_SetValueWithAlloc(void* This, void* OutVal, |
| 98 | + void* OpaqueType); |
| 99 | +#endif |
| 100 | + |
| 101 | + extern "C" void __clang_Interpreter_SetValueNoAlloc(void* This, |
| 102 | + void* OutVal, |
| 103 | + void* OpaqueType, ...); |
95 | 104 |
|
96 | 105 | namespace Cpp { |
97 | 106 |
|
@@ -3476,8 +3485,23 @@ TInterp_t CreateInterpreter(const std::vector<const char*>& Args /*={}*/, |
3476 | 3485 | sInterpreters->back().get()}); |
3477 | 3486 |
|
3478 | 3487 | assert(sInterpreters->size() == sInterpreterASTMap->size()); |
3479 | | -// define __clang_Interpreter_SetValueNoAlloc in the JIT dylib for clang-repl |
| 3488 | + |
| 3489 | +// Define runtime symbols in the JIT dylib for clang-repl |
3480 | 3490 | #ifndef CPPINTEROP_USE_CLING |
| 3491 | +#if CLANG_VERSION_MAJOR > 22 |
| 3492 | + DefineAbsoluteSymbol(*I, "__clang_Interpreter_SetValueWithAlloc", |
| 3493 | + (uint64_t)&__clang_Interpreter_SetValueNoAlloc); |
| 3494 | +#else |
| 3495 | + auto* D = static_cast<clang::Decl*>( |
| 3496 | + Cpp::GetNamed("__clang_Interpreter_SetValueWithAlloc")); |
| 3497 | + if (auto* FD = llvm::dyn_cast<FunctionDecl>(D)) { |
| 3498 | + auto GD = GlobalDecl(FD); |
| 3499 | + std::string mangledName; |
| 3500 | + compat::maybeMangleDeclName(GD, mangledName); |
| 3501 | + DefineAbsoluteSymbol(*I, mangledName.c_str(), |
| 3502 | + (uint64_t)&__clang_Interpreter_SetValueWithAlloc); |
| 3503 | + } |
| 3504 | +#endif |
3481 | 3505 | DefineAbsoluteSymbol(*I, "__clang_Interpreter_SetValueNoAlloc", |
3482 | 3506 | (uint64_t)&__clang_Interpreter_SetValueNoAlloc); |
3483 | 3507 | #endif |
|
0 commit comments