[clang] [clang] Enable descriptions for --print-supported-extensions (PR #66715)

David Spickett via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 20 08:17:28 PDT 2023


================
@@ -198,13 +199,20 @@ static int PrintSupportedExtensions(std::string TargetStr) {
   std::unique_ptr<llvm::TargetMachine> TheTargetMachine(
       TheTarget->createTargetMachine(TargetStr, "", "", Options, std::nullopt));
   const llvm::Triple &MachineTriple = TheTargetMachine->getTargetTriple();
+  const llvm::MCSubtargetInfo *MCInfo = TheTargetMachine->getMCSubtargetInfo();
----------------
DavidSpickett wrote:

I was wrong, clang doesn't recognise the triple if it wasn't enabled:
```
$ ./bin/clang --target=riscv64-linux-gnu --print-support
clang version 18.0.0 (https://github.com/llvm/llvm-project.git ebefe83c092e41d243829ab812bb650674e2f3d2)
Target: riscv64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/david.spickett/build-llvm-aarch64/./bin
No available targets are compatible with triple "riscv64-unknown-linux-gnu"
```

So we won't get to this code if the target backend is missing. No worries :)

https://github.com/llvm/llvm-project/pull/66715


More information about the cfe-commits mailing list