mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-29 18:23:49 +00:00
Extend preprocessor LLVM version checks to support LLVM 4.x
This doesn't actually do anything for LLVM 4.x yet, but sets the stage.
This commit is contained in:
parent
b786976a15
commit
e6e117c33a
@ -22,7 +22,7 @@ struct RustArchiveMember {
|
|||||||
Archive::Child child;
|
Archive::Child child;
|
||||||
|
|
||||||
RustArchiveMember(): filename(NULL), name(NULL),
|
RustArchiveMember(): filename(NULL), name(NULL),
|
||||||
#if LLVM_VERSION_MINOR >= 8
|
#if LLVM_VERSION_GE(3, 8)
|
||||||
child(NULL, NULL, NULL)
|
child(NULL, NULL, NULL)
|
||||||
#else
|
#else
|
||||||
child(NULL, NULL)
|
child(NULL, NULL)
|
||||||
@ -35,7 +35,7 @@ struct RustArchiveMember {
|
|||||||
struct RustArchiveIterator {
|
struct RustArchiveIterator {
|
||||||
Archive::child_iterator cur;
|
Archive::child_iterator cur;
|
||||||
Archive::child_iterator end;
|
Archive::child_iterator end;
|
||||||
#if LLVM_VERSION_MINOR >= 9
|
#if LLVM_VERSION_GE(3, 9)
|
||||||
Error err;
|
Error err;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
@ -81,7 +81,7 @@ LLVMRustOpenArchive(char *path) {
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if LLVM_VERSION_MINOR <= 8
|
#if LLVM_VERSION_LE(3, 8)
|
||||||
ErrorOr<std::unique_ptr<Archive>> archive_or =
|
ErrorOr<std::unique_ptr<Archive>> archive_or =
|
||||||
#else
|
#else
|
||||||
Expected<std::unique_ptr<Archive>> archive_or =
|
Expected<std::unique_ptr<Archive>> archive_or =
|
||||||
@ -89,7 +89,7 @@ LLVMRustOpenArchive(char *path) {
|
|||||||
Archive::create(buf_or.get()->getMemBufferRef());
|
Archive::create(buf_or.get()->getMemBufferRef());
|
||||||
|
|
||||||
if (!archive_or) {
|
if (!archive_or) {
|
||||||
#if LLVM_VERSION_MINOR <= 8
|
#if LLVM_VERSION_LE(3, 8)
|
||||||
LLVMRustSetLastError(archive_or.getError().message().c_str());
|
LLVMRustSetLastError(archive_or.getError().message().c_str());
|
||||||
#else
|
#else
|
||||||
LLVMRustSetLastError(toString(archive_or.takeError()).c_str());
|
LLVMRustSetLastError(toString(archive_or.takeError()).c_str());
|
||||||
@ -112,7 +112,7 @@ extern "C" LLVMRustArchiveIteratorRef
|
|||||||
LLVMRustArchiveIteratorNew(LLVMRustArchiveRef ra) {
|
LLVMRustArchiveIteratorNew(LLVMRustArchiveRef ra) {
|
||||||
Archive *ar = ra->getBinary();
|
Archive *ar = ra->getBinary();
|
||||||
RustArchiveIterator *rai = new RustArchiveIterator();
|
RustArchiveIterator *rai = new RustArchiveIterator();
|
||||||
#if LLVM_VERSION_MINOR <= 8
|
#if LLVM_VERSION_LE(3, 8)
|
||||||
rai->cur = ar->child_begin();
|
rai->cur = ar->child_begin();
|
||||||
#else
|
#else
|
||||||
rai->cur = ar->child_begin(rai->err);
|
rai->cur = ar->child_begin(rai->err);
|
||||||
@ -127,7 +127,7 @@ LLVMRustArchiveIteratorNew(LLVMRustArchiveRef ra) {
|
|||||||
|
|
||||||
extern "C" LLVMRustArchiveChildConstRef
|
extern "C" LLVMRustArchiveChildConstRef
|
||||||
LLVMRustArchiveIteratorNext(LLVMRustArchiveIteratorRef rai) {
|
LLVMRustArchiveIteratorNext(LLVMRustArchiveIteratorRef rai) {
|
||||||
#if LLVM_VERSION_MINOR >= 9
|
#if LLVM_VERSION_GE(3, 9)
|
||||||
if (rai->err) {
|
if (rai->err) {
|
||||||
LLVMRustSetLastError(toString(std::move(rai->err)).c_str());
|
LLVMRustSetLastError(toString(std::move(rai->err)).c_str());
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -135,7 +135,7 @@ LLVMRustArchiveIteratorNext(LLVMRustArchiveIteratorRef rai) {
|
|||||||
#endif
|
#endif
|
||||||
if (rai->cur == rai->end)
|
if (rai->cur == rai->end)
|
||||||
return NULL;
|
return NULL;
|
||||||
#if LLVM_VERSION_MINOR == 8
|
#if LLVM_VERSION_EQ(3, 8)
|
||||||
const ErrorOr<Archive::Child>* cur = rai->cur.operator->();
|
const ErrorOr<Archive::Child>* cur = rai->cur.operator->();
|
||||||
if (!*cur) {
|
if (!*cur) {
|
||||||
LLVMRustSetLastError(cur->getError().message().c_str());
|
LLVMRustSetLastError(cur->getError().message().c_str());
|
||||||
@ -207,7 +207,7 @@ LLVMRustWriteArchive(char *Dst,
|
|||||||
bool WriteSymbtab,
|
bool WriteSymbtab,
|
||||||
LLVMRustArchiveKind rust_kind) {
|
LLVMRustArchiveKind rust_kind) {
|
||||||
|
|
||||||
#if LLVM_VERSION_MINOR <= 8
|
#if LLVM_VERSION_LE(3, 8)
|
||||||
std::vector<NewArchiveIterator> Members;
|
std::vector<NewArchiveIterator> Members;
|
||||||
#else
|
#else
|
||||||
std::vector<NewArchiveMember> Members;
|
std::vector<NewArchiveMember> Members;
|
||||||
@ -218,20 +218,20 @@ LLVMRustWriteArchive(char *Dst,
|
|||||||
auto Member = NewMembers[i];
|
auto Member = NewMembers[i];
|
||||||
assert(Member->name);
|
assert(Member->name);
|
||||||
if (Member->filename) {
|
if (Member->filename) {
|
||||||
#if LLVM_VERSION_MINOR >= 9
|
#if LLVM_VERSION_GE(3, 9)
|
||||||
Expected<NewArchiveMember> MOrErr = NewArchiveMember::getFile(Member->filename, true);
|
Expected<NewArchiveMember> MOrErr = NewArchiveMember::getFile(Member->filename, true);
|
||||||
if (!MOrErr) {
|
if (!MOrErr) {
|
||||||
LLVMRustSetLastError(toString(MOrErr.takeError()).c_str());
|
LLVMRustSetLastError(toString(MOrErr.takeError()).c_str());
|
||||||
return LLVMRustResult::Failure;
|
return LLVMRustResult::Failure;
|
||||||
}
|
}
|
||||||
Members.push_back(std::move(*MOrErr));
|
Members.push_back(std::move(*MOrErr));
|
||||||
#elif LLVM_VERSION_MINOR == 8
|
#elif LLVM_VERSION_EQ(3, 8)
|
||||||
Members.push_back(NewArchiveIterator(Member->filename));
|
Members.push_back(NewArchiveIterator(Member->filename));
|
||||||
#else
|
#else
|
||||||
Members.push_back(NewArchiveIterator(Member->filename, Member->name));
|
Members.push_back(NewArchiveIterator(Member->filename, Member->name));
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
#if LLVM_VERSION_MINOR <= 8
|
#if LLVM_VERSION_LE(3, 8)
|
||||||
Members.push_back(NewArchiveIterator(Member->child, Member->name));
|
Members.push_back(NewArchiveIterator(Member->child, Member->name));
|
||||||
#else
|
#else
|
||||||
Expected<NewArchiveMember> MOrErr = NewArchiveMember::getOldMember(Member->child, true);
|
Expected<NewArchiveMember> MOrErr = NewArchiveMember::getOldMember(Member->child, true);
|
||||||
@ -243,7 +243,7 @@ LLVMRustWriteArchive(char *Dst,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if LLVM_VERSION_MINOR >= 8
|
#if LLVM_VERSION_GE(3, 8)
|
||||||
auto pair = writeArchive(Dst, Members, WriteSymbtab, Kind, true, false);
|
auto pair = writeArchive(Dst, Members, WriteSymbtab, Kind, true, false);
|
||||||
#else
|
#else
|
||||||
auto pair = writeArchive(Dst, Members, WriteSymbtab, Kind, true);
|
auto pair = writeArchive(Dst, Members, WriteSymbtab, Kind, true);
|
||||||
|
@ -46,7 +46,7 @@ LLVMInitializePasses() {
|
|||||||
initializeVectorization(Registry);
|
initializeVectorization(Registry);
|
||||||
initializeIPO(Registry);
|
initializeIPO(Registry);
|
||||||
initializeAnalysis(Registry);
|
initializeAnalysis(Registry);
|
||||||
#if LLVM_VERSION_MINOR == 7
|
#if LLVM_VERSION_EQ(3, 7)
|
||||||
initializeIPA(Registry);
|
initializeIPA(Registry);
|
||||||
#endif
|
#endif
|
||||||
initializeTransformUtils(Registry);
|
initializeTransformUtils(Registry);
|
||||||
@ -297,7 +297,7 @@ LLVMRustCreateTargetMachine(const char *triple,
|
|||||||
bool FunctionSections,
|
bool FunctionSections,
|
||||||
bool DataSections) {
|
bool DataSections) {
|
||||||
|
|
||||||
#if LLVM_VERSION_MINOR <= 8
|
#if LLVM_VERSION_LE(3, 8)
|
||||||
Reloc::Model RM;
|
Reloc::Model RM;
|
||||||
#else
|
#else
|
||||||
Optional<Reloc::Model> RM;
|
Optional<Reloc::Model> RM;
|
||||||
@ -316,7 +316,7 @@ LLVMRustCreateTargetMachine(const char *triple,
|
|||||||
RM = Reloc::DynamicNoPIC;
|
RM = Reloc::DynamicNoPIC;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
#if LLVM_VERSION_MINOR <= 8
|
#if LLVM_VERSION_LE(3, 8)
|
||||||
RM = Reloc::Default;
|
RM = Reloc::Default;
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
@ -337,7 +337,7 @@ LLVMRustCreateTargetMachine(const char *triple,
|
|||||||
}
|
}
|
||||||
|
|
||||||
TargetOptions Options;
|
TargetOptions Options;
|
||||||
#if LLVM_VERSION_MINOR <= 8
|
#if LLVM_VERSION_LE(3, 8)
|
||||||
Options.PositionIndependentExecutable = PositionIndependentExecutable;
|
Options.PositionIndependentExecutable = PositionIndependentExecutable;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -539,7 +539,7 @@ extern "C" void
|
|||||||
LLVMRustRunRestrictionPass(LLVMModuleRef M, char **symbols, size_t len) {
|
LLVMRustRunRestrictionPass(LLVMModuleRef M, char **symbols, size_t len) {
|
||||||
llvm::legacy::PassManager passes;
|
llvm::legacy::PassManager passes;
|
||||||
|
|
||||||
#if LLVM_VERSION_MINOR <= 8
|
#if LLVM_VERSION_LE(3, 8)
|
||||||
ArrayRef<const char*> ref(symbols, len);
|
ArrayRef<const char*> ref(symbols, len);
|
||||||
passes.add(llvm::createInternalizePass(ref));
|
passes.add(llvm::createInternalizePass(ref));
|
||||||
#else
|
#else
|
||||||
@ -593,7 +593,7 @@ LLVMRustGetModuleDataLayout(LLVMModuleRef M) {
|
|||||||
|
|
||||||
extern "C" void
|
extern "C" void
|
||||||
LLVMRustSetModulePIELevel(LLVMModuleRef M) {
|
LLVMRustSetModulePIELevel(LLVMModuleRef M) {
|
||||||
#if LLVM_VERSION_MINOR >= 9
|
#if LLVM_VERSION_GE(3, 9)
|
||||||
unwrap(M)->setPIELevel(PIELevel::Level::Large);
|
unwrap(M)->setPIELevel(PIELevel::Level::Large);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -394,7 +394,7 @@ extern "C" LLVMRustMetadataRef LLVMRustDIBuilderCreateSubroutineType(
|
|||||||
LLVMRustMetadataRef File,
|
LLVMRustMetadataRef File,
|
||||||
LLVMRustMetadataRef ParameterTypes) {
|
LLVMRustMetadataRef ParameterTypes) {
|
||||||
return wrap(Builder->createSubroutineType(
|
return wrap(Builder->createSubroutineType(
|
||||||
#if LLVM_VERSION_MINOR == 7
|
#if LLVM_VERSION_EQ(3, 7)
|
||||||
unwrapDI<DIFile>(File),
|
unwrapDI<DIFile>(File),
|
||||||
#endif
|
#endif
|
||||||
DITypeRefArray(unwrap<MDTuple>(ParameterTypes))));
|
DITypeRefArray(unwrap<MDTuple>(ParameterTypes))));
|
||||||
@ -416,7 +416,7 @@ extern "C" LLVMRustMetadataRef LLVMRustDIBuilderCreateFunction(
|
|||||||
LLVMValueRef Fn,
|
LLVMValueRef Fn,
|
||||||
LLVMRustMetadataRef TParam,
|
LLVMRustMetadataRef TParam,
|
||||||
LLVMRustMetadataRef Decl) {
|
LLVMRustMetadataRef Decl) {
|
||||||
#if LLVM_VERSION_MINOR >= 8
|
#if LLVM_VERSION_GE(3, 8)
|
||||||
DITemplateParameterArray TParams =
|
DITemplateParameterArray TParams =
|
||||||
DITemplateParameterArray(unwrap<MDTuple>(TParam));
|
DITemplateParameterArray(unwrap<MDTuple>(TParam));
|
||||||
DISubprogram *Sub = Builder->createFunction(
|
DISubprogram *Sub = Builder->createFunction(
|
||||||
@ -565,7 +565,7 @@ extern "C" LLVMRustMetadataRef LLVMRustDIBuilderCreateVariable(
|
|||||||
int64_t* AddrOps,
|
int64_t* AddrOps,
|
||||||
unsigned AddrOpsCount,
|
unsigned AddrOpsCount,
|
||||||
unsigned ArgNo) {
|
unsigned ArgNo) {
|
||||||
#if LLVM_VERSION_MINOR >= 8
|
#if LLVM_VERSION_GE(3, 8)
|
||||||
if (Tag == 0x100) { // DW_TAG_auto_variable
|
if (Tag == 0x100) { // DW_TAG_auto_variable
|
||||||
return wrap(Builder->createAutoVariable(
|
return wrap(Builder->createAutoVariable(
|
||||||
unwrapDI<DIDescriptor>(Scope), Name,
|
unwrapDI<DIDescriptor>(Scope), Name,
|
||||||
@ -814,7 +814,7 @@ LLVMRustLinkInExternalBitcode(LLVMModuleRef dst, char *bc, size_t len) {
|
|||||||
|
|
||||||
raw_string_ostream Stream(Err);
|
raw_string_ostream Stream(Err);
|
||||||
DiagnosticPrinterRawOStream DP(Stream);
|
DiagnosticPrinterRawOStream DP(Stream);
|
||||||
#if LLVM_VERSION_MINOR >= 8
|
#if LLVM_VERSION_GE(3, 8)
|
||||||
if (Linker::linkModules(*Dst, std::move(Src.get()))) {
|
if (Linker::linkModules(*Dst, std::move(Src.get()))) {
|
||||||
#else
|
#else
|
||||||
if (Linker::LinkModules(Dst, Src->get(), [&](const DiagnosticInfo &DI) { DI.print(DP); })) {
|
if (Linker::LinkModules(Dst, Src->get(), [&](const DiagnosticInfo &DI) { DI.print(DP); })) {
|
||||||
@ -937,14 +937,14 @@ to_rust(DiagnosticKind kind)
|
|||||||
return LLVMRustDiagnosticKind::OptimizationRemarkMissed;
|
return LLVMRustDiagnosticKind::OptimizationRemarkMissed;
|
||||||
case DK_OptimizationRemarkAnalysis:
|
case DK_OptimizationRemarkAnalysis:
|
||||||
return LLVMRustDiagnosticKind::OptimizationRemarkAnalysis;
|
return LLVMRustDiagnosticKind::OptimizationRemarkAnalysis;
|
||||||
#if LLVM_VERSION_MINOR >= 8
|
#if LLVM_VERSION_GE(3, 8)
|
||||||
case DK_OptimizationRemarkAnalysisFPCommute:
|
case DK_OptimizationRemarkAnalysisFPCommute:
|
||||||
return LLVMRustDiagnosticKind::OptimizationRemarkAnalysisFPCommute;
|
return LLVMRustDiagnosticKind::OptimizationRemarkAnalysisFPCommute;
|
||||||
case DK_OptimizationRemarkAnalysisAliasing:
|
case DK_OptimizationRemarkAnalysisAliasing:
|
||||||
return LLVMRustDiagnosticKind::OptimizationRemarkAnalysisAliasing;
|
return LLVMRustDiagnosticKind::OptimizationRemarkAnalysisAliasing;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
#if LLVM_VERSION_MINOR >= 9
|
#if LLVM_VERSION_GE(3, 9)
|
||||||
return (kind >= DK_FirstRemark && kind <= DK_LastRemark) ?
|
return (kind >= DK_FirstRemark && kind <= DK_LastRemark) ?
|
||||||
LLVMRustDiagnosticKind::OptimizationRemarkOther :
|
LLVMRustDiagnosticKind::OptimizationRemarkOther :
|
||||||
LLVMRustDiagnosticKind::Other;
|
LLVMRustDiagnosticKind::Other;
|
||||||
@ -994,7 +994,7 @@ extern "C" LLVMTypeKind LLVMRustGetTypeKind(LLVMTypeRef Ty) {
|
|||||||
return LLVMVectorTypeKind;
|
return LLVMVectorTypeKind;
|
||||||
case Type::X86_MMXTyID:
|
case Type::X86_MMXTyID:
|
||||||
return LLVMX86_MMXTypeKind;
|
return LLVMX86_MMXTypeKind;
|
||||||
#if LLVM_VERSION_MINOR >= 8
|
#if LLVM_VERSION_GE(3, 8)
|
||||||
case Type::TokenTyID:
|
case Type::TokenTyID:
|
||||||
return LLVMTokenTypeKind;
|
return LLVMTokenTypeKind;
|
||||||
#endif
|
#endif
|
||||||
@ -1043,7 +1043,7 @@ LLVMRustBuildCleanupPad(LLVMBuilderRef Builder,
|
|||||||
unsigned ArgCnt,
|
unsigned ArgCnt,
|
||||||
LLVMValueRef *LLArgs,
|
LLVMValueRef *LLArgs,
|
||||||
const char *Name) {
|
const char *Name) {
|
||||||
#if LLVM_VERSION_MINOR >= 8
|
#if LLVM_VERSION_GE(3, 8)
|
||||||
Value **Args = unwrap(LLArgs);
|
Value **Args = unwrap(LLArgs);
|
||||||
if (ParentPad == NULL) {
|
if (ParentPad == NULL) {
|
||||||
Type *Ty = Type::getTokenTy(unwrap(Builder)->getContext());
|
Type *Ty = Type::getTokenTy(unwrap(Builder)->getContext());
|
||||||
@ -1061,7 +1061,7 @@ extern "C" LLVMValueRef
|
|||||||
LLVMRustBuildCleanupRet(LLVMBuilderRef Builder,
|
LLVMRustBuildCleanupRet(LLVMBuilderRef Builder,
|
||||||
LLVMValueRef CleanupPad,
|
LLVMValueRef CleanupPad,
|
||||||
LLVMBasicBlockRef UnwindBB) {
|
LLVMBasicBlockRef UnwindBB) {
|
||||||
#if LLVM_VERSION_MINOR >= 8
|
#if LLVM_VERSION_GE(3, 8)
|
||||||
CleanupPadInst *Inst = cast<CleanupPadInst>(unwrap(CleanupPad));
|
CleanupPadInst *Inst = cast<CleanupPadInst>(unwrap(CleanupPad));
|
||||||
return wrap(unwrap(Builder)->CreateCleanupRet(Inst, unwrap(UnwindBB)));
|
return wrap(unwrap(Builder)->CreateCleanupRet(Inst, unwrap(UnwindBB)));
|
||||||
#else
|
#else
|
||||||
@ -1075,7 +1075,7 @@ LLVMRustBuildCatchPad(LLVMBuilderRef Builder,
|
|||||||
unsigned ArgCnt,
|
unsigned ArgCnt,
|
||||||
LLVMValueRef *LLArgs,
|
LLVMValueRef *LLArgs,
|
||||||
const char *Name) {
|
const char *Name) {
|
||||||
#if LLVM_VERSION_MINOR >= 8
|
#if LLVM_VERSION_GE(3, 8)
|
||||||
Value **Args = unwrap(LLArgs);
|
Value **Args = unwrap(LLArgs);
|
||||||
return wrap(unwrap(Builder)->CreateCatchPad(unwrap(ParentPad),
|
return wrap(unwrap(Builder)->CreateCatchPad(unwrap(ParentPad),
|
||||||
ArrayRef<Value*>(Args, ArgCnt),
|
ArrayRef<Value*>(Args, ArgCnt),
|
||||||
@ -1089,7 +1089,7 @@ extern "C" LLVMValueRef
|
|||||||
LLVMRustBuildCatchRet(LLVMBuilderRef Builder,
|
LLVMRustBuildCatchRet(LLVMBuilderRef Builder,
|
||||||
LLVMValueRef Pad,
|
LLVMValueRef Pad,
|
||||||
LLVMBasicBlockRef BB) {
|
LLVMBasicBlockRef BB) {
|
||||||
#if LLVM_VERSION_MINOR >= 8
|
#if LLVM_VERSION_GE(3, 8)
|
||||||
return wrap(unwrap(Builder)->CreateCatchRet(cast<CatchPadInst>(unwrap(Pad)),
|
return wrap(unwrap(Builder)->CreateCatchRet(cast<CatchPadInst>(unwrap(Pad)),
|
||||||
unwrap(BB)));
|
unwrap(BB)));
|
||||||
#else
|
#else
|
||||||
@ -1103,7 +1103,7 @@ LLVMRustBuildCatchSwitch(LLVMBuilderRef Builder,
|
|||||||
LLVMBasicBlockRef BB,
|
LLVMBasicBlockRef BB,
|
||||||
unsigned NumHandlers,
|
unsigned NumHandlers,
|
||||||
const char *Name) {
|
const char *Name) {
|
||||||
#if LLVM_VERSION_MINOR >= 8
|
#if LLVM_VERSION_GE(3, 8)
|
||||||
if (ParentPad == NULL) {
|
if (ParentPad == NULL) {
|
||||||
Type *Ty = Type::getTokenTy(unwrap(Builder)->getContext());
|
Type *Ty = Type::getTokenTy(unwrap(Builder)->getContext());
|
||||||
ParentPad = wrap(Constant::getNullValue(Ty));
|
ParentPad = wrap(Constant::getNullValue(Ty));
|
||||||
@ -1120,7 +1120,7 @@ LLVMRustBuildCatchSwitch(LLVMBuilderRef Builder,
|
|||||||
extern "C" void
|
extern "C" void
|
||||||
LLVMRustAddHandler(LLVMValueRef CatchSwitchRef,
|
LLVMRustAddHandler(LLVMValueRef CatchSwitchRef,
|
||||||
LLVMBasicBlockRef Handler) {
|
LLVMBasicBlockRef Handler) {
|
||||||
#if LLVM_VERSION_MINOR >= 8
|
#if LLVM_VERSION_GE(3, 8)
|
||||||
Value *CatchSwitch = unwrap(CatchSwitchRef);
|
Value *CatchSwitch = unwrap(CatchSwitchRef);
|
||||||
cast<CatchSwitchInst>(CatchSwitch)->addHandler(unwrap(Handler));
|
cast<CatchSwitchInst>(CatchSwitch)->addHandler(unwrap(Handler));
|
||||||
#endif
|
#endif
|
||||||
@ -1129,14 +1129,14 @@ LLVMRustAddHandler(LLVMValueRef CatchSwitchRef,
|
|||||||
extern "C" void
|
extern "C" void
|
||||||
LLVMRustSetPersonalityFn(LLVMBuilderRef B,
|
LLVMRustSetPersonalityFn(LLVMBuilderRef B,
|
||||||
LLVMValueRef Personality) {
|
LLVMValueRef Personality) {
|
||||||
#if LLVM_VERSION_MINOR >= 8
|
#if LLVM_VERSION_GE(3, 8)
|
||||||
unwrap(B)->GetInsertBlock()
|
unwrap(B)->GetInsertBlock()
|
||||||
->getParent()
|
->getParent()
|
||||||
->setPersonalityFn(cast<Function>(unwrap(Personality)));
|
->setPersonalityFn(cast<Function>(unwrap(Personality)));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if LLVM_VERSION_MINOR >= 8
|
#if LLVM_VERSION_GE(3, 8)
|
||||||
extern "C" OperandBundleDef*
|
extern "C" OperandBundleDef*
|
||||||
LLVMRustBuildOperandBundleDef(const char *Name,
|
LLVMRustBuildOperandBundleDef(const char *Name,
|
||||||
LLVMValueRef *Inputs,
|
LLVMValueRef *Inputs,
|
||||||
|
@ -45,7 +45,16 @@
|
|||||||
#include "llvm-c/ExecutionEngine.h"
|
#include "llvm-c/ExecutionEngine.h"
|
||||||
#include "llvm-c/Object.h"
|
#include "llvm-c/Object.h"
|
||||||
|
|
||||||
#if LLVM_VERSION_MINOR >= 7
|
#define LLVM_VERSION_GE(major, minor) \
|
||||||
|
(LLVM_VERSION_MAJOR > (major) || LLVM_VERSION_MAJOR == (major) && LLVM_VERSION_MINOR >= (minor))
|
||||||
|
|
||||||
|
#define LLVM_VERSION_EQ(major, minor) \
|
||||||
|
(LLVM_VERSION_MAJOR == (major) && LLVM_VERSION_MINOR == (minor))
|
||||||
|
|
||||||
|
#define LLVM_VERSION_LE(major, minor) \
|
||||||
|
(LLVM_VERSION_MAJOR < (major) || LLVM_VERSION_MAJOR == (major) && LLVM_VERSION_MINOR <= (minor))
|
||||||
|
|
||||||
|
#if LLVM_VERSION_GE(3, 7)
|
||||||
#include "llvm/IR/LegacyPassManager.h"
|
#include "llvm/IR/LegacyPassManager.h"
|
||||||
#else
|
#else
|
||||||
#include "llvm/PassManager.h"
|
#include "llvm/PassManager.h"
|
||||||
|
Loading…
Reference in New Issue
Block a user