diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2021-12-02 21:02:54 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2021-12-02 21:02:54 +0000 |
commit | f65dcba83ce5035ab88a85fe17628b447eb56e1b (patch) | |
tree | 35f37bb72b3cfc6060193e66c76ee7c9478969b0 /llvm/lib/Support/CommandLine.cpp | |
parent | 846a2208a8ab099f595fe7e8b2e6d54a7b5e67fb (diff) |
Diffstat (limited to 'llvm/lib/Support/CommandLine.cpp')
-rw-r--r-- | llvm/lib/Support/CommandLine.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/llvm/lib/Support/CommandLine.cpp b/llvm/lib/Support/CommandLine.cpp index e64934aa90cc..5b7004c86f5a 100644 --- a/llvm/lib/Support/CommandLine.cpp +++ b/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); } } |