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

David Spickett via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 19 03:21:33 PDT 2023


================
@@ -600,11 +601,17 @@ StringRef ARM::getARMCPUForArch(const llvm::Triple &Triple, StringRef MArch) {
   llvm_unreachable("invalid arch name");
 }
 
-void ARM::PrintSupportedExtensions() {
+void ARM::PrintSupportedExtensions(std::map<StringRef, StringRef> llvmDescMap) {
   outs() << "All available -march extensions for ARM\n\n";
   for (const auto &Ext : ARCHExtNames) {
     // Extensions without a feature cannot be used with -march.
-    if (!Ext.Feature.empty())
-      outs() << '\t' << Ext.Name << "\n";
+    if (!Ext.Feature.empty()) {
+      if (llvmDescMap.empty()) {
+        outs() << '\t' << Ext.Name << "\n";
+      } else {
+        outs() << format("\t%-20s", Ext.Name.str().c_str());
+        outs() << "\t\t" << llvmDescMap[Ext.Name] << "\n";
----------------
DavidSpickett wrote:

Sorry, I think I wasn't clear, I meant this could be one call:
```
outs() << format("\t%-20s", Ext.Name.str().c_str());
outs() << "\t\t" << llvmDescMap[Ext.Name] << "\n";
```
As in:
```
outs() << format("\t%-20s", Ext.Name.str().c_str())
          << "\t\t" << llvmDescMap[Ext.Name] << "\n";
```

I didn't mean that having an if/else was a bad idea.

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


More information about the cfe-commits mailing list