[PATCH] D57030: [CommandLine] Don't print empty sentinel values from EnumValN lists in help text

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 22 03:12:45 PST 2019


jhenderson updated this revision to Diff 182879.
jhenderson added a comment.

Don't print empty description for option value with no description.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57030/new/

https://reviews.llvm.org/D57030

Files:
  lib/Support/CommandLine.cpp


Index: lib/Support/CommandLine.cpp
===================================================================
--- lib/Support/CommandLine.cpp
+++ lib/Support/CommandLine.cpp
@@ -1676,9 +1676,13 @@
     Option::printHelpStr(O.HelpStr, GlobalWidth, O.ArgStr.size() + 6);
 
     for (unsigned i = 0, e = getNumOptions(); i != e; ++i) {
+      if(getOption(i).empty() && getDescription(i).empty())
+        continue;
       size_t NumSpaces = GlobalWidth - getOption(i).size() - 8;
       outs() << "    =" << getOption(i);
-      outs().indent(NumSpaces) << " -   " << getDescription(i) << '\n';
+      if (!getDescription(i).empty())
+        outs().indent(NumSpaces) << " -   " << getDescription(i);
+      outs() << '\n';
     }
   } else {
     if (!O.HelpStr.empty())


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57030.182879.patch
Type: text/x-patch
Size: 763 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190122/4c81bcb9/attachment.bin>


More information about the llvm-commits mailing list