]> git.lizzy.rs Git - rust.git/commitdiff
Gate LLVMRustHasFeature on LLVM_RUSTLLVM
authorJosh Stone <jistone@redhat.com>
Tue, 1 Aug 2017 01:10:01 +0000 (18:10 -0700)
committerJosh Stone <jistone@redhat.com>
Tue, 1 Aug 2017 01:10:01 +0000 (18:10 -0700)
Commit c4710203c098b in #43492 make `LLVMRustHasFeature` "more robust"
by using `getFeatureTable()`.  However, this function is specific to
Rust's own LLVM fork, not upstream LLVM-4.0, so we need to use
`#if LLVM_RUSTLLVM` to guard this call.

src/rustllvm/PassWrapper.cpp

index 57e90be27748f3e1ca24ffb557007454661b5aa9..bca0881c08c5a35a433f9b61dea2e17e9e8fe178 100644 (file)
@@ -178,10 +178,10 @@ GEN_SUBTARGETS
 
 extern "C" bool LLVMRustHasFeature(LLVMTargetMachineRef TM,
                                    const char *Feature) {
+#if LLVM_RUSTLLVM
   TargetMachine *Target = unwrap(TM);
   const MCSubtargetInfo *MCInfo = Target->getMCSubtargetInfo();
   const FeatureBitset &Bits = MCInfo->getFeatureBits();
-#if LLVM_VERSION_GE(4, 0)
   const ArrayRef<SubtargetFeatureKV> FeatTable = MCInfo->getFeatureTable();
 
   for (auto &FeatureEntry : FeatTable)