Skip to content

Commit 91e392d

Browse files
committed
Support recent cling.
1 parent af8e902 commit 91e392d

File tree

1 file changed

+13
-21
lines changed

1 file changed

+13
-21
lines changed

lib/Interpreter/Compatibility.h

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,14 @@ getSymbolAddress(const cling::Interpreter& I, llvm::StringRef IRName) {
110110

111111
llvm::orc::LLJIT& Jit = *compat::getExecutionEngine(I);
112112
llvm::orc::SymbolNameVector Names;
113-
Names.push_back(Jit.getExecutionSession().intern(IRName));
113+
llvm::orc::ExecutionSession& ES = Jit.getExecutionSession();
114+
Names.push_back(ES.intern(IRName));
115+
#if CLANG_VERSION_MAJOR < 16
114116
return llvm::make_error<llvm::orc::SymbolsNotFound>(Names);
117+
#else
118+
return llvm::make_error<llvm::orc::SymbolsNotFound>(ES.getSymbolStringPool(),
119+
std::move(Names));
120+
#endif // CLANG_VERSION_MAJOR
115121
}
116122

117123
inline void codeComplete(std::vector<std::string>& Results,
@@ -399,29 +405,15 @@ inline std::string MakeResourceDir(llvm::StringRef Dir) {
399405
}
400406

401407
// Clang >= 16 (=16 with Value patch) change castAs to converTo
402-
#if CLANG_VERSION_MAJOR >= 16
403-
template <typename T>
404-
inline T convertTo(
405-
#ifdef USE_CLING
406-
cling::Value V
407-
#else
408-
clang::Value V
409-
#endif
410-
) {
411-
return V.convertTo<T>();
412-
}
413-
#else
414-
template <typename T>
415-
inline T convertTo(
416408
#ifdef USE_CLING
417-
cling::Value V
418-
#else
419-
clang::Value V
420-
#endif
421-
) {
409+
template <typename T> inline T convertTo(cling::Value V) {
422410
return V.castAs<T>();
423411
}
424-
#endif
412+
#else // CLANG_REPL
413+
template <typename T> inline T convertTo(clang::Value V) {
414+
return V.convertTo<T>();
415+
}
416+
#endif // USE_CLING
425417

426418
} // namespace compat
427419

0 commit comments

Comments
 (0)