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

David Spickett via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 19 02:32:58 PDT 2023


================
@@ -198,13 +199,21 @@ 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();
+  const llvm::ArrayRef<llvm::SubtargetFeatureKV> Features =
+    MCInfo->getAllProcessorFeatures();
+
+  std::map<StringRef, StringRef> llvmDescMap;
+  for (const llvm::SubtargetFeatureKV &feature : Features) {
+    llvmDescMap.insert(std::make_pair(feature.Key, feature.Desc));
----------------
DavidSpickett wrote:

https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements

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


More information about the cfe-commits mailing list