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

Balint Cristian via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 20 15:13:46 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();
----------------
cbalint13 wrote:

On my side on this topic I already checked this situation, yes looks protected well.

@DavidSpickett 

As sidenote here, on this topic opened by you: 

* In case of ```createTargetMachine```, notice the -mcpu="" (second argument), it will force to **return all target information**. If you specify i.e. "sandybridge" than you can only access list of features and descriptions only related to "sandybridge" subarchtecture / subset .

* I really hope LLVM will keep this (-mcpu="" => ALL) , and not cut it out (some developer will think is a "safer" API), otherwise it will be impossible to query LLVM features of **a whole target**.

LLVM looks (to humble me) very dynamic with frequent API changes, my point here is a "utilitarian view" as external user I would like to take benefits and features through API.


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


More information about the cfe-commits mailing list