// lines that use it.
def Unsupported : OptionFlag;
+// HelpHidden - The option should not be displayed in --help, even if it has
+// help text. Clients *can* use this in conjuction with the OptTable::PrintHelp
+// arguments to implement hidden help groups.
+def HelpHidden : OptionFlag;
+
// Define the option group class.
class OptionGroup<string name> {
namespace options {
enum DriverFlag {
DriverOption = (1 << 0),
- LinkerInput = (1 << 1),
- NoArgumentUnused = (1 << 2),
- RenderAsInput = (1 << 3),
- RenderJoined = (1 << 4),
- RenderSeparate = (1 << 5),
- Unsupported = (1 << 6)
+ HelpHidden = (1 << 1),
+ LinkerInput = (1 << 2),
+ NoArgumentUnused = (1 << 3),
+ RenderAsInput = (1 << 4),
+ RenderJoined = (1 << 5),
+ RenderSeparate = (1 << 6),
+ Unsupported = (1 << 7)
};
}
return getInfo(id).Kind;
}
+ /// isOptionHelpHidden - Should the help for the given option be hidden by
+ /// default.
+ bool isOptionHelpHidden(OptSpecifier id) const {
+ return getInfo(id).Flags & options::HelpHidden;
+ }
+
/// getOptionHelpText - Get the help text to use to describe this option.
const char *getOptionHelpText(OptSpecifier id) const {
return getInfo(id).HelpText;
/// \param OS - The stream to write the help text to.
/// \param Name - The name to use in the usage line.
/// \param Title - The title to use in the usage line.
+ /// \param ShowHidden - Whether help-hidden arguments should be shown.
void PrintHelp(llvm::raw_ostream &OS, const char *Name,
- const char *Title) const;
+ const char *Title, bool ShowHidden = false) const;
};
}
}
}
void OptTable::PrintHelp(llvm::raw_ostream &OS, const char *Name,
- const char *Title) const {
+ const char *Title, bool ShowHidden) const {
OS << "OVERVIEW: " << Title << "\n";
OS << '\n';
OS << "USAGE: " << Name << " [options] <inputs>\n";
std::vector< std::pair<std::string, const char*> > OptionHelp;
for (unsigned i = 0, e = getNumOptions(); i != e; ++i) {
unsigned Id = i + 1;
+
+ if (!ShowHidden && isOptionHelpHidden(Id))
+ continue;
+
if (const char *Text = getOptionHelpText(Id))
OptionHelp.push_back(std::make_pair(getOptionHelpName(*this, Id), Text));
}