[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:25:15 PDT 2023


================
@@ -210,24 +210,33 @@ static void verifyTables() {
 #endif
 }
 
-void llvm::riscvExtensionsHelp() {
+void llvm::riscvExtensionsHelp(std::map<StringRef, StringRef> llvmDescMap) {
+
   outs() << "All available -march extensions for RISC-V\n\n";
-  outs() << '\t' << left_justify("Name", 20) << "Version\n";
+  outs() << '\t' << left_justify("Name", 20) << "Version";
+  outs() << (llvmDescMap.empty() ? "\n" : "\tDescription\n");
 
   RISCVISAInfo::OrderedExtensionMap ExtMap;
   for (const auto &E : SupportedExtensions)
     ExtMap[E.Name] = {E.Version.Major, E.Version.Minor};
-  for (const auto &E : ExtMap)
-    outs() << format("\t%-20s%d.%d\n", E.first.c_str(), E.second.MajorVersion,
+  for (const auto &E : ExtMap) {
+    outs() << format("\t%-20s%d.%d", E.first.c_str(), E.second.MajorVersion,
                      E.second.MinorVersion);
+    outs() << (llvmDescMap.empty() ? "\n"
----------------
DavidSpickett wrote:

> Basically with this feature we have an option to skip "Description" column at all.

I see what you mean now. Yes I agree, if there's some architecture that provides 0 descriptions then having it doesn't make any sense.

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


More information about the cfe-commits mailing list