summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/CommandLine.cpp
diff options
context:
space:
mode:
authorChris Bieneman <beanz@apple.com>2015-01-26 21:57:29 +0000
committerChris Bieneman <beanz@apple.com>2015-01-26 21:57:29 +0000
commit0104325776cc77e3e109b6d085bf4378e725d763 (patch)
tree40e6bc1c4604205d79a34086f7e928a9a36cc338 /llvm/lib/Support/CommandLine.cpp
parent8e0dec7c80577bdcf4c5fa90f2ba5e2a6a2210d2 (diff)
downloadbcm5719-llvm-0104325776cc77e3e109b6d085bf4378e725d763.tar.gz
bcm5719-llvm-0104325776cc77e3e109b6d085bf4378e725d763.zip
Add new HideUnrelatedOptions API that takes a SmallVectorImpl.
Need a new API for clang-modernize that allows specifying a list of option categories to remain visible. This will allow clang-modernize to move off getRegisteredOptions. llvm-svn: 227140
Diffstat (limited to 'llvm/lib/Support/CommandLine.cpp')
-rw-r--r--llvm/lib/Support/CommandLine.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/lib/Support/CommandLine.cpp b/llvm/lib/Support/CommandLine.cpp
index 87f2261def5..4cd6f0c5f0a 100644
--- a/llvm/lib/Support/CommandLine.cpp
+++ b/llvm/lib/Support/CommandLine.cpp
@@ -1861,6 +1861,20 @@ void cl::HideUnrelatedOptions(cl::OptionCategory &Category) {
}
}
+void cl::HideUnrelatedOptions(
+ SmallVectorImpl<cl::OptionCategory *> &Categories) {
+ auto CategoriesBegin = Categories.begin();
+ auto CategoriesEnd = Categories.end();
+ StringMap<cl::Option *> Options;
+ cl::getRegisteredOptions(Options);
+ for (auto &I : Options) {
+ if (std::find(CategoriesBegin, CategoriesEnd, I.second->Category) ==
+ CategoriesEnd &&
+ I.second->Category != &GenericCategory)
+ I.second->setHiddenFlag(cl::ReallyHidden);
+ }
+}
+
void LLVMParseCommandLineOptions(int argc, const char *const *argv,
const char *Overview) {
llvm::cl::ParseCommandLineOptions(argc, argv, Overview);
OpenPOWER on IntegriCloud