[PATCH] Adopt new cl::HideUnrelatedOptions API added r226729.

Phabricator reviews at reviews.llvm.org
Wed Jan 21 15:27:45 PST 2015


REPOSITORY
  rL LLVM

http://reviews.llvm.org/D7109

Files:
  cfe/trunk/lib/Tooling/CommonOptionsParser.cpp
  cfe/trunk/tools/clang-format/ClangFormat.cpp

Index: cfe/trunk/lib/Tooling/CommonOptionsParser.cpp
===================================================================
--- cfe/trunk/lib/Tooling/CommonOptionsParser.cpp
+++ cfe/trunk/lib/Tooling/CommonOptionsParser.cpp
@@ -112,15 +112,7 @@
       cl::desc("Additional argument to prepend to the compiler command line"),
       cl::cat(Category));
 
-  // Hide unrelated options.
-  StringMap<cl::Option*> Options;
-  cl::getRegisteredOptions(Options);
-  for (StringMap<cl::Option *>::iterator I = Options.begin(), E = Options.end();
-       I != E; ++I) {
-    if (I->second->Category != &Category && I->first() != "help" &&
-        I->first() != "version")
-      I->second->setHiddenFlag(cl::ReallyHidden);
-  }
+  cl::HideUnrelatedOptions(Category);
 
   Compilations.reset(FixedCompilationDatabase::loadFromCommandLine(argc,
                                                                    argv));
Index: cfe/trunk/tools/clang-format/ClangFormat.cpp
===================================================================
--- cfe/trunk/tools/clang-format/ClangFormat.cpp
+++ cfe/trunk/tools/clang-format/ClangFormat.cpp
@@ -270,15 +270,7 @@
 int main(int argc, const char **argv) {
   llvm::sys::PrintStackTraceOnErrorSignal();
 
-  // Hide unrelated options.
-  StringMap<cl::Option*> Options;
-  cl::getRegisteredOptions(Options);
-  for (StringMap<cl::Option *>::iterator I = Options.begin(), E = Options.end();
-       I != E; ++I) {
-    if (I->second->Category != &ClangFormatCategory && I->first() != "help" &&
-        I->first() != "version")
-      I->second->setHiddenFlag(cl::ReallyHidden);
-  }
+  cl::HideUnrelatedOptions(ClangFormatCategory);
 
   cl::SetVersionPrinter(PrintVersion);
   cl::ParseCommandLineOptions(

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7109.18561.patch
Type: text/x-patch
Size: 1739 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150121/dd07a1ac/attachment.bin>


More information about the cfe-commits mailing list