Auto merge of #115079 - cuviper:unused-mcinfo, r=Mark-Simulacrum

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:       |                          ^~~~~~
```
This commit is contained in:
bors 2023-08-27 10:32:24 +00:00
commit d1fb1755aa

View File

@ -321,13 +321,13 @@ extern "C" void LLVMRustPrintTargetCPUs(LLVMTargetMachineRef TM,
PrintBackendInfo Print, PrintBackendInfo Print,
void* Out) { void* Out) {
const TargetMachine *Target = unwrap(TM); const TargetMachine *Target = unwrap(TM);
const MCSubtargetInfo *MCInfo = Target->getMCSubtargetInfo();
const Triple::ArchType HostArch = Triple(sys::getDefaultTargetTriple()).getArch(); const Triple::ArchType HostArch = Triple(sys::getDefaultTargetTriple()).getArch();
const Triple::ArchType TargetArch = Target->getTargetTriple().getArch(); const Triple::ArchType TargetArch = Target->getTargetTriple().getArch();
std::ostringstream Buf; std::ostringstream Buf;
#if LLVM_VERSION_GE(17, 0) #if LLVM_VERSION_GE(17, 0)
const MCSubtargetInfo *MCInfo = Target->getMCSubtargetInfo();
const ArrayRef<SubtargetSubTypeKV> CPUTable = MCInfo->getAllProcessorDescriptions(); const ArrayRef<SubtargetSubTypeKV> CPUTable = MCInfo->getAllProcessorDescriptions();
#else #else
Buf << "Full target CPU help is not supported by this LLVM version.\n\n"; Buf << "Full target CPU help is not supported by this LLVM version.\n\n";