aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/llvm/lib/Support/CommandLine.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2021-12-02 21:49:08 +0000
committerDimitry Andric <dim@FreeBSD.org>2022-06-04 11:59:04 +0000
commit574b7079b96703a748f89ef5adb7dc3e26b8f7fc (patch)
tree195000196b1e0cc13dea43258fa240e006f48184 /contrib/llvm-project/llvm/lib/Support/CommandLine.cpp
parent1f6fd64fe9c996b4795ee4a6c66b8f9216747560 (diff)
Diffstat (limited to 'contrib/llvm-project/llvm/lib/Support/CommandLine.cpp')
-rw-r--r--contrib/llvm-project/llvm/lib/Support/CommandLine.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/contrib/llvm-project/llvm/lib/Support/CommandLine.cpp b/contrib/llvm-project/llvm/lib/Support/CommandLine.cpp
index e64934aa90cc..5b7004c86f5a 100644
--- a/contrib/llvm-project/llvm/lib/Support/CommandLine.cpp
+++ b/contrib/llvm-project/llvm/lib/Support/CommandLine.cpp
@@ -2656,10 +2656,13 @@ cl::getRegisteredSubcommands() {
void cl::HideUnrelatedOptions(cl::OptionCategory &Category, SubCommand &Sub) {
initCommonOptions();
for (auto &I : Sub.OptionsMap) {
+ bool Unrelated = true;
for (auto &Cat : I.second->Categories) {
- if (Cat != &Category && Cat != &CommonOptions->GenericCategory)
- I.second->setHiddenFlag(cl::ReallyHidden);
+ if (Cat == &Category || Cat == &CommonOptions->GenericCategory)
+ Unrelated = false;
}
+ if (Unrelated)
+ I.second->setHiddenFlag(cl::ReallyHidden);
}
}
@@ -2667,11 +2670,14 @@ void cl::HideUnrelatedOptions(ArrayRef<const cl::OptionCategory *> Categories,
SubCommand &Sub) {
initCommonOptions();
for (auto &I : Sub.OptionsMap) {
+ bool Unrelated = true;
for (auto &Cat : I.second->Categories) {
- if (!is_contained(Categories, Cat) &&
- Cat != &CommonOptions->GenericCategory)
- I.second->setHiddenFlag(cl::ReallyHidden);
+ if (is_contained(Categories, Cat) ||
+ Cat == &CommonOptions->GenericCategory)
+ Unrelated = false;
}
+ if (Unrelated)
+ I.second->setHiddenFlag(cl::ReallyHidden);
}
}