fully exploited the dropped support of LLVM 8
This commit grepped for LLVM_VERSION_GE, LLVM_VERSION_LT, get_major_version and min-llvm-version and statically evaluated every expression possible (and sensible) assuming that the LLVM version is >=9 now
This commit is contained in:
@@ -124,9 +124,7 @@ extern "C" LLVMValueRef LLVMRustGetOrInsertFunction(LLVMModuleRef M,
|
||||
return wrap(unwrap(M)
|
||||
->getOrInsertFunction(StringRef(Name, NameLen),
|
||||
unwrap<FunctionType>(FunctionTy))
|
||||
#if LLVM_VERSION_GE(9, 0)
|
||||
.getCallee()
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
@@ -251,11 +249,7 @@ extern "C" void LLVMRustAddDereferenceableOrNullCallSiteAttr(LLVMValueRef Instr,
|
||||
extern "C" void LLVMRustAddByValCallSiteAttr(LLVMValueRef Instr, unsigned Index,
|
||||
LLVMTypeRef Ty) {
|
||||
CallBase *Call = unwrap<CallBase>(Instr);
|
||||
#if LLVM_VERSION_GE(9, 0)
|
||||
Attribute Attr = Attribute::getWithByValType(Call->getContext(), unwrap(Ty));
|
||||
#else
|
||||
Attribute Attr = Attribute::get(Call->getContext(), Attribute::ByVal);
|
||||
#endif
|
||||
Call->addAttribute(Index, Attr);
|
||||
}
|
||||
|
||||
@@ -296,11 +290,7 @@ extern "C" void LLVMRustAddDereferenceableOrNullAttr(LLVMValueRef Fn,
|
||||
extern "C" void LLVMRustAddByValAttr(LLVMValueRef Fn, unsigned Index,
|
||||
LLVMTypeRef Ty) {
|
||||
Function *F = unwrap<Function>(Fn);
|
||||
#if LLVM_VERSION_GE(9, 0)
|
||||
Attribute Attr = Attribute::getWithByValType(F->getContext(), unwrap(Ty));
|
||||
#else
|
||||
Attribute Attr = Attribute::get(F->getContext(), Attribute::ByVal);
|
||||
#endif
|
||||
F->addAttribute(Index, Attr);
|
||||
}
|
||||
|
||||
@@ -616,11 +606,9 @@ static DISubprogram::DISPFlags fromRust(LLVMRustDISPFlags SPFlags) {
|
||||
if (isSet(SPFlags & LLVMRustDISPFlags::SPFlagOptimized)) {
|
||||
Result |= DISubprogram::DISPFlags::SPFlagOptimized;
|
||||
}
|
||||
#if LLVM_VERSION_GE(9, 0)
|
||||
if (isSet(SPFlags & LLVMRustDISPFlags::SPFlagMainSubprogram)) {
|
||||
Result |= DISubprogram::DISPFlags::SPFlagMainSubprogram;
|
||||
}
|
||||
#endif
|
||||
|
||||
return Result;
|
||||
}
|
||||
@@ -744,10 +732,6 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateFunction(
|
||||
DITemplateParameterArray(unwrap<MDTuple>(TParam));
|
||||
DISubprogram::DISPFlags llvmSPFlags = fromRust(SPFlags);
|
||||
DINode::DIFlags llvmFlags = fromRust(Flags);
|
||||
#if LLVM_VERSION_LT(9, 0)
|
||||
if (isSet(SPFlags & LLVMRustDISPFlags::SPFlagMainSubprogram))
|
||||
llvmFlags |= DINode::DIFlags::FlagMainSubprogram;
|
||||
#endif
|
||||
DISubprogram *Sub = Builder->createFunction(
|
||||
unwrapDI<DIScope>(Scope),
|
||||
StringRef(Name, NameLen),
|
||||
|
||||
Reference in New Issue
Block a user