LGTM.

> On 2015-Jan-21, at 15:02, Chris Bieneman <[email protected]> wrote:
> 
> Hi dexonsmith,
> 
> cl::HideUnrelatedOptions allows tools to hide all options not part of a 
> specific OptionCategory. This is the common use case for 
> cl::getRegisteredOptions, which should be deprecated in the future because it 
> exposes implementation details of command line parsing.
> 
> http://reviews.llvm.org/D7109
> 
> Files:
>  lib/Tooling/CommonOptionsParser.cpp
>  tools/clang-format/ClangFormat.cpp
> 
> Index: lib/Tooling/CommonOptionsParser.cpp
> ===================================================================
> --- lib/Tooling/CommonOptionsParser.cpp
> +++ 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: tools/clang-format/ClangFormat.cpp
> ===================================================================
> --- tools/clang-format/ClangFormat.cpp
> +++ 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/
> <D7109.18559.patch>


_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to