@@ -104,43 +104,13 @@ inline void maybeMangleDeclName(const clang::GlobalDecl& GD,
104104 cling::utils::Analyze::maybeMangleDeclName (GD, mangledName);
105105}
106106
107- // / For Cling <= LLVM 16, this is a horrible hack obtaining the private
108- // / llvm::orc::LLJIT by computing the object offsets in the cling::Interpreter
109- // / instance(IncrementalExecutor): sizeof (m_Opts) + sizeof(m_LLVMContext). The
110- // / IncrementalJIT and JIT itself have an offset of 0 as the first datamember.
111- // /
112- // / The getExecutionEngine() interface has been added for Cling based on LLVM
113- // / >=18 and should be used in future releases.
107+ // / The getExecutionEngine() interface was been added for Cling based on LLVM
108+ // / >=18. For previous versions, the LLJIT was obtained by computing the object
109+ // / offsets in the cling::Interpreter instance(IncrementalExecutor):
110+ // / sizeof (m_Opts) + sizeof(m_LLVMContext). The IncrementalJIT and JIT itself
111+ // / have an offset of 0 as the first datamember.
114112inline llvm::orc::LLJIT* getExecutionEngine (cling::Interpreter& I) {
115- #if CLANG_VERSION_MAJOR >= 18
116113 return I.getExecutionEngine ();
117- #endif
118-
119- unsigned m_ExecutorOffset = 0 ;
120-
121- #if CLANG_VERSION_MAJOR == 13
122- #ifdef __APPLE__
123- m_ExecutorOffset = 62 ;
124- #else
125- m_ExecutorOffset = 72 ;
126- #endif // __APPLE__
127- #endif
128-
129- // Note: The offsets changed in Cling based on LLVM 16 with the introduction of
130- // a thread safe context - llvm::orc::ThreadSafeContext
131- #if CLANG_VERSION_MAJOR == 16
132- #ifdef __APPLE__
133- m_ExecutorOffset = 68 ;
134- #else
135- m_ExecutorOffset = 78 ;
136- #endif // __APPLE__
137- #endif
138-
139- int * IncrementalExecutor =
140- ((int *)(const_cast <cling::Interpreter*>(&I))) + m_ExecutorOffset;
141- int * IncrementalJit = *(int **)IncrementalExecutor + 0 ;
142- int * LLJIT = *(int **)IncrementalJit + 0 ;
143- return *(llvm::orc::LLJIT**)LLJIT;
144114}
145115
146116inline llvm::Expected<llvm::JITTargetAddress>
0 commit comments