[PATCH] D82001: [llvm] [CommandLine] Do not suggest really hidden opts in nearest lookup

Michał Górny via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 17 03:44:52 PDT 2020


mgorny created this revision.
mgorny added reviewers: chandlerc, lattner, beanz, bkramer, njames93.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.

Skip 'really hidden' options when performing lookup of the nearest
option when invalid option was passed.  Since these options aren't even
documented in --help-hidden, it seems inconsistent to suggest them
to users.

This fixes clang-tools-extra test failures due to unexpected suggestions
when linking the tools to LLVM dylib (that provides more options than
the subset of LLVM libraries linked directly).


https://reviews.llvm.org/D82001

Files:
  llvm/lib/Support/CommandLine.cpp


Index: llvm/lib/Support/CommandLine.cpp
===================================================================
--- llvm/lib/Support/CommandLine.cpp
+++ llvm/lib/Support/CommandLine.cpp
@@ -592,6 +592,10 @@
                                            ie = OptionsMap.end();
        it != ie; ++it) {
     Option *O = it->second;
+    // Do not suggest really hidden options (not shown in any help).
+    if (O->getOptionHiddenFlag() == ReallyHidden)
+      continue;
+
     SmallVector<StringRef, 16> OptionNames;
     O->getExtraOptionNames(OptionNames);
     if (O->hasArgStr())


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82001.271323.patch
Type: text/x-patch
Size: 577 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200617/8918392f/attachment.bin>


More information about the llvm-commits mailing list