Skip to content

Commit ef06519

Browse files
committed
Move a local to the #if block where it is used
For other cases (LLVM < 17), this was complaining under `-Wall`: ``` warning: llvm-wrapper/PassWrapper.cpp: In function ‘void LLVMRustPrintTargetCPUs(LLVMTargetMachineRef, const char*)’: warning: llvm-wrapper/PassWrapper.cpp:311:26: warning: unused variable ‘MCInfo’ [-Wunused-variable] warning: 311 | const MCSubtargetInfo *MCInfo = Target->getMCSubtargetInfo(); warning: | ^~~~~~ ```
1 parent fe5f591 commit ef06519

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -321,13 +321,13 @@ extern "C" void LLVMRustPrintTargetCPUs(LLVMTargetMachineRef TM,
321321
PrintBackendInfo Print,
322322
void* Out) {
323323
const TargetMachine *Target = unwrap(TM);
324-
const MCSubtargetInfo *MCInfo = Target->getMCSubtargetInfo();
325324
const Triple::ArchType HostArch = Triple(sys::getDefaultTargetTriple()).getArch();
326325
const Triple::ArchType TargetArch = Target->getTargetTriple().getArch();
327326

328327
std::ostringstream Buf;
329328

330329
#if LLVM_VERSION_GE(17, 0)
330+
const MCSubtargetInfo *MCInfo = Target->getMCSubtargetInfo();
331331
const ArrayRef<SubtargetSubTypeKV> CPUTable = MCInfo->getAllProcessorDescriptions();
332332
#else
333333
Buf << "Full target CPU help is not supported by this LLVM version.\n\n";

0 commit comments

Comments
 (0)