@@ -492,13 +492,8 @@ inline LLVMRustDIFlags visibility(LLVMRustDIFlags F) {
492
492
return static_cast <LLVMRustDIFlags>(static_cast <uint32_t >(F) & 0x3 );
493
493
}
494
494
495
- #if LLVM_VERSION_GE(4, 0)
496
495
static DINode::DIFlags fromRust (LLVMRustDIFlags Flags) {
497
496
DINode::DIFlags Result = DINode::DIFlags::FlagZero;
498
- #else
499
- static unsigned fromRust (LLVMRustDIFlags Flags) {
500
- unsigned Result = 0 ;
501
- #endif
502
497
503
498
switch (visibility (Flags)) {
504
499
case LLVMRustDIFlags::FlagPrivate:
@@ -565,14 +560,12 @@ static unsigned fromRust(LLVMRustDIFlags Flags) {
565
560
if (isSet (Flags & LLVMRustDIFlags::FlagBitField)) {
566
561
Result |= DINode::DIFlags::FlagBitField;
567
562
}
568
- #if LLVM_RUSTLLVM || LLVM_VERSION_GE(4, 0)
569
563
if (isSet (Flags & LLVMRustDIFlags::FlagNoReturn)) {
570
564
Result |= DINode::DIFlags::FlagNoReturn;
571
565
}
572
566
if (isSet (Flags & LLVMRustDIFlags::FlagMainSubprogram)) {
573
567
Result |= DINode::DIFlags::FlagMainSubprogram;
574
568
}
575
- #endif
576
569
577
570
return Result;
578
571
}
@@ -612,14 +605,8 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateCompileUnit(
612
605
unsigned RuntimeVer, const char *SplitName) {
613
606
auto *File = unwrapDI<DIFile>(FileRef);
614
607
615
- #if LLVM_VERSION_GE(4, 0)
616
608
return wrap (Builder->createCompileUnit (Lang, File, Producer, isOptimized,
617
609
Flags, RuntimeVer, SplitName));
618
- #else
619
- return wrap (Builder->createCompileUnit (Lang, File->getFilename (),
620
- File->getDirectory (), Producer, isOptimized,
621
- Flags, RuntimeVer, SplitName));
622
- #endif
623
610
}
624
611
625
612
extern " C" LLVMMetadataRef
@@ -657,11 +644,7 @@ extern "C" LLVMMetadataRef
657
644
LLVMRustDIBuilderCreateBasicType (LLVMRustDIBuilderRef Builder, const char *Name,
658
645
uint64_t SizeInBits, uint32_t AlignInBits,
659
646
unsigned Encoding) {
660
- return wrap (Builder->createBasicType (Name, SizeInBits,
661
- #if LLVM_VERSION_LE(3, 9)
662
- AlignInBits,
663
- #endif
664
- Encoding));
647
+ return wrap (Builder->createBasicType (Name, SizeInBits, Encoding));
665
648
}
666
649
667
650
extern " C" LLVMMetadataRef LLVMRustDIBuilderCreatePointerType (
@@ -722,7 +705,6 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateStaticVariable(
722
705
LLVMMetadataRef Decl = nullptr , uint32_t AlignInBits = 0 ) {
723
706
llvm::GlobalVariable *InitVal = cast<llvm::GlobalVariable>(unwrap (V));
724
707
725
- #if LLVM_VERSION_GE(4, 0)
726
708
llvm::DIExpression *InitExpr = nullptr ;
727
709
if (llvm::ConstantInt *IntVal = llvm::dyn_cast<llvm::ConstantInt>(InitVal)) {
728
710
InitExpr = Builder->createConstantValueExpression (
@@ -741,12 +723,6 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateStaticVariable(
741
723
InitVal->setMetadata (" dbg" , VarExpr);
742
724
743
725
return wrap (VarExpr);
744
- #else
745
- return wrap (Builder->createGlobalVariable (
746
- unwrapDI<DIDescriptor>(Context), Name, LinkageName,
747
- unwrapDI<DIFile>(File), LineNo, unwrapDI<DIType>(Ty), IsLocalToUnit,
748
- InitVal, unwrapDIPtr<MDNode>(Decl)));
749
- #endif
750
726
}
751
727
752
728
extern " C" LLVMMetadataRef LLVMRustDIBuilderCreateVariable (
@@ -757,12 +733,7 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateVariable(
757
733
if (Tag == 0x100 ) { // DW_TAG_auto_variable
758
734
return wrap (Builder->createAutoVariable (
759
735
unwrapDI<DIDescriptor>(Scope), Name, unwrapDI<DIFile>(File), LineNo,
760
- unwrapDI<DIType>(Ty), AlwaysPreserve, fromRust (Flags)
761
- #if LLVM_VERSION_GE(4, 0)
762
- ,
763
- AlignInBits
764
- #endif
765
- ));
736
+ unwrapDI<DIType>(Ty), AlwaysPreserve, fromRust (Flags), AlignInBits));
766
737
} else {
767
738
return wrap (Builder->createParameterVariable (
768
739
unwrapDI<DIDescriptor>(Scope), Name, ArgNo, unwrapDI<DIFile>(File),
0 commit comments