Merge "Hide unused options in header-abi-linker help message"

This commit is contained in:
Treehugger Robot
2018-09-04 07:27:34 +00:00
committed by Gerrit Code Review

View File

@@ -389,7 +389,23 @@ bool HeaderAbiLinker::ParseSoFile() {
return true; return true;
} }
// Hide irrelevant command line options defined in LLVM libraries.
static void HideIrrelevantCommandLineOptions() {
llvm::StringMap<llvm::cl::Option *> &map = llvm::cl::getRegisteredOptions();
for (llvm::StringMapEntry<llvm::cl::Option *> &p : map) {
if (p.second->Category == &header_linker_category) {
continue;
}
if (p.first().startswith("help")) {
continue;
}
p.second->setHiddenFlag(llvm::cl::Hidden);
}
}
int main(int argc, const char **argv) { int main(int argc, const char **argv) {
HideIrrelevantCommandLineOptions();
llvm::cl::ParseCommandLineOptions(argc, argv, "header-linker"); llvm::cl::ParseCommandLineOptions(argc, argv, "header-linker");
if (so_file.empty() && version_script.empty()) { if (so_file.empty() && version_script.empty()) {
llvm::errs() << "One of -so or -v needs to be specified\n"; llvm::errs() << "One of -so or -v needs to be specified\n";