diff --git a/src/tcompiler.cpp b/src/tcompiler.cpp index 362905f11..7ac89d208 100644 --- a/src/tcompiler.cpp +++ b/src/tcompiler.cpp @@ -22,6 +22,10 @@ extern "C" { #if LLVM_VERSION < 50 #include "llvm/ExecutionEngine/MCJIT.h" +#else +#if LLVM_VERSION < 120 +#include "llvm/ExecutionEngine/OrcMCJITReplacement.h" +#endif #endif #include "llvm/Support/Atomic.h" @@ -387,6 +391,9 @@ static void InitializeJIT(TerraCompilationUnit *CU) { .setMCJITMemoryManager(make_unique(CU)) #else .setMCJITMemoryManager(std::make_unique(CU)) +#endif +#if LLVM_VERSION < 120 + .setOrcMCJITReplacement(true) #endif ; #endif @@ -2486,7 +2493,15 @@ struct FunctionEmitter { DEBUG_ONLY(T) { MDNode *scope = debugScopeForFile(customfilename ? customfilename : obj->string("filename")); - B->SetCurrentDebugLocation(DILocation::get(scope->getContext(), customfilename ? customlinenumber : obj->number("linenumber"), 0, scope)); +#if LLVM_VERSION < 120 + B->SetCurrentDebugLocation(DebugLoc::get( + customfilename ? customlinenumber : obj->number("linenumber"), 0, + scope)); +#else + B->SetCurrentDebugLocation(DILocation::get(scope->getContext(), + customfilename ? customlinenumber : obj->number("linenumber"), 0, + scope)); +#endif } } diff --git a/src/tcwrapper.cpp b/src/tcwrapper.cpp index d4472c61c..704db47f8 100644 --- a/src/tcwrapper.cpp +++ b/src/tcwrapper.cpp @@ -328,16 +328,14 @@ class IncludeCVisitor : public RecursiveASTVisitor { } CStyleCastExpr *CreateCast(QualType Ty, CastKind Kind, Expr *E) { TypeSourceInfo *TInfo = Context->getTrivialTypeSourceInfo(Ty, SourceLocation()); - return CStyleCastExpr::Create(*Context, - Ty, - VK_RValue, - Kind, - E, - 0, // CXXCastPath BasePath (?) +#if LLVM_VERSION < 120 + return CStyleCastExpr::Create(*Context, Ty, VK_RValue, Kind, E, 0, TInfo, + SourceLocation(), SourceLocation()); +#else + return CStyleCastExpr::Create(*Context, Ty, VK_RValue, Kind, E, 0, FPOptionsOverride::getFromOpaqueInt(0), - TInfo, - SourceLocation(), - SourceLocation()); + TInfo, SourceLocation(), SourceLocation()); +#endif } IntegerLiteral *LiteralZero() { unsigned IntSize = static_cast(Context->getTypeSize(Context->IntTy));