diff --git a/gen/typinf.cpp b/gen/typinf.cpp index b88fec6a..0bcb42a0 100644 --- a/gen/typinf.cpp +++ b/gen/typinf.cpp @@ -16,6 +16,7 @@ #include #include "gen/llvm.h" +#include "gen/llvm-version.h" #include "mars.h" #include "module.h" @@ -317,7 +318,11 @@ void DtoResolveTypeInfo(TypeInfoDeclaration* tid) mdVals[TD_Confirm] = llvm::cast(irg->value); mdVals[TD_Type] = llvm::UndefValue::get(DtoType(tid->tinfo)); // Construct the metadata +#if LLVM_REV < 77733 llvm::MetadataBase* metadata = gIR->context().getMDNode(mdVals, TD_NumFields); +#else + llvm::MetadataBase* metadata = MDNode::get(Context, mdVals, TD_NumFields); +#endif // Insert it into the module llvm::NamedMDNode::Create(metaname, &metadata, 1, gIR->module); } diff --git a/ir/irclass.cpp b/ir/irclass.cpp index edb73c65..fdff088c 100644 --- a/ir/irclass.cpp +++ b/ir/irclass.cpp @@ -5,6 +5,7 @@ #include "declaration.h" #include "mtype.h" +#include "gen/llvm-version.h" #include "gen/irstate.h" #include "gen/logger.h" #include "gen/tollvm.h" @@ -86,7 +87,11 @@ LLGlobalVariable * IrStruct::getClassInfoSymbol() mdVals[CD_Finalize] = LLConstantInt::get(LLType::Int1Ty, hasDestructor); mdVals[CD_CustomDelete] = LLConstantInt::get(LLType::Int1Ty, hasCustomDelete); // Construct the metadata +#if LLVM_REV < 77733 llvm::MetadataBase* metadata = gIR->context().getMDNode(mdVals, CD_NumFields); +#else + llvm::MetadataBase* metadata = MDNode::get(Context, mdVals, CD_NumFields); +#endif // Insert it into the module std::string metaname = CD_PREFIX + initname; llvm::NamedMDNode::Create(metaname, &metadata, 1, gIR->module);