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 Options; - cl::getRegisteredOptions(Options); - for (StringMap::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 Options; - cl::getRegisteredOptions(Options); - for (StringMap::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(