1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00

Add 'hidden' and 'really_hidden' option properties.

llvm-svn: 60198
This commit is contained in:
Mikhail Glushenkov 2008-11-28 00:13:25 +00:00
parent 45f83604cd
commit 187b171022
3 changed files with 53 additions and 3 deletions

View File

@ -38,10 +38,12 @@ def prefix_list_option;
def append_cmd;
def forward;
def forward_as;
def help;
def hidden;
def really_hidden;
def required;
def stop_compilation;
def unpack_values;
def help;
def required;
// Empty DAG marker.
def empty;

View File

@ -353,6 +353,12 @@ currently implemented option types and properties are described below:
- ``required`` - this option is obligatory.
- ``hidden`` - this option should not appear in the ``--help``
output (but should appear in the ``--help-hidden`` output).
- ``really_hidden`` - the option should not appear in any help
output.
Option list - specifying all options in a single place
======================================================

View File

@ -198,7 +198,8 @@ struct OptionDescription {
// Global option description.
namespace GlobalOptionDescriptionFlags {
enum GlobalOptionDescriptionFlags { Required = 0x1 };
enum GlobalOptionDescriptionFlags { Required = 0x1, Hidden = 0x2,
ReallyHidden = 0x4 };
}
struct GlobalOptionDescription : public OptionDescription {
@ -222,6 +223,20 @@ struct GlobalOptionDescription : public OptionDescription {
Flags |= GlobalOptionDescriptionFlags::Required;
}
bool isHidden() const {
return Flags & GlobalOptionDescriptionFlags::Hidden;
}
void setHidden() {
Flags |= GlobalOptionDescriptionFlags::Hidden;
}
bool isReallyHidden() const {
return Flags & GlobalOptionDescriptionFlags::ReallyHidden;
}
void setReallyHidden() {
Flags |= GlobalOptionDescriptionFlags::ReallyHidden;
}
/// Merge - Merge two option descriptions.
void Merge (const GlobalOptionDescription& other)
{
@ -412,8 +427,12 @@ public:
&CollectOptionProperties::onForwardAs;
optionPropertyHandlers_["help"] =
&CollectOptionProperties::onHelp;
optionPropertyHandlers_["hidden"] =
&CollectOptionProperties::onHidden;
optionPropertyHandlers_["output_suffix"] =
&CollectOptionProperties::onOutputSuffix;
optionPropertyHandlers_["really_hidden"] =
&CollectOptionProperties::onReallyHidden;
optionPropertyHandlers_["required"] =
&CollectOptionProperties::onRequired;
optionPropertyHandlers_["stop_compilation"] =
@ -493,6 +512,18 @@ private:
optDesc_.Help = help_message;
}
void onHidden (const DagInit* d) {
checkNumberOfArguments(d, 0);
checkToolProps(d);
optDesc_.setHidden();
}
void onReallyHidden (const DagInit* d) {
checkNumberOfArguments(d, 0);
checkToolProps(d);
optDesc_.setReallyHidden();
}
void onRequired (const DagInit* d) {
checkNumberOfArguments(d, 0);
checkToolProps(d);
@ -1413,6 +1444,17 @@ void EmitOptionDescriptions (const GlobalOptionDescriptions& descs,
}
}
if (val.isReallyHidden() || val.isHidden()) {
if (val.isRequired())
O << " |";
else
O << ",";
if (val.isReallyHidden())
O << " cl::ReallyHidden";
else
O << " cl::Hidden";
}
if (!val.Help.empty())
O << ", cl::desc(\"" << val.Help << "\")";