[clang] [clang] Enable descriptions for --print-supported-extensions (PR #66715)
David Spickett via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 20 07:53:34 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 just thought of one more thing. What happens here if the build was configured without the target backend enabled?
For example if CMake was configred with `-DLLVM_TARGETS_TO_BUILD=ARM`, and you ask for the RISC-V extensions, does clang crash?
Though that is an unusual thing to do, but it is possible since clang knows about all possible triples even without a target backend. And besides that, clang shouldn't crash anyway. Simplest solution is to pass an empty description map I think, and add a test for that situation.
https://github.com/llvm/llvm-project/pull/66715
More information about the cfe-commits
mailing list