mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-27 21:50:40 +00:00
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227140 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
38c35f3e2c
commit
7006a12ba3
@ -1931,6 +1931,15 @@ bool ExpandResponseFiles(StringSaver &Saver, TokenizerCallback Tokenizer,
|
||||
/// option category to display in the -help output.
|
||||
void HideUnrelatedOptions(cl::OptionCategory &Category);
|
||||
|
||||
/// \brief Mark all options not part of the categories as cl::ReallyHidden.
|
||||
///
|
||||
/// \param Categories the categories of options to keep displaying.
|
||||
///
|
||||
/// Some tools (like clang-format) like to be able to hide all options that are
|
||||
/// not specific to the tool. This function allows a tool to specify a single
|
||||
/// option category to display in the -help output.
|
||||
void HideUnrelatedOptions(SmallVectorImpl<cl::OptionCategory *> &Categories);
|
||||
|
||||
} // End namespace cl
|
||||
|
||||
} // End namespace llvm
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user