Skip to content

Commit

Permalink
Gate LLVMRustHasFeature on LLVM_RUSTLLVM
Browse files Browse the repository at this point in the history
Commit c471020 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.
  • Loading branch information
cuviper committed Aug 1, 2017
1 parent 37c7d0e commit 881a724
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/rustllvm/PassWrapper.cpp
Expand Up @@ -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)
Expand Down

0 comments on commit 881a724

Please sign in to comment.