Add 'hidden' and 'really_hidden' option properties.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60198 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/llvm/CompilerDriver/Common.td b/include/llvm/CompilerDriver/Common.td
index 4589f91..109a7e5 100644
--- a/include/llvm/CompilerDriver/Common.td
+++ b/include/llvm/CompilerDriver/Common.td
@@ -38,10 +38,12 @@
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;
diff --git a/tools/llvmc/doc/LLVMC-Reference.rst b/tools/llvmc/doc/LLVMC-Reference.rst
index 2907784..9190255 100644
--- a/tools/llvmc/doc/LLVMC-Reference.rst
+++ b/tools/llvmc/doc/LLVMC-Reference.rst
@@ -353,6 +353,12 @@
- ``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
======================================================
diff --git a/utils/TableGen/LLVMCConfigurationEmitter.cpp b/utils/TableGen/LLVMCConfigurationEmitter.cpp
index da4ed78..668282a 100644
--- a/utils/TableGen/LLVMCConfigurationEmitter.cpp
+++ b/utils/TableGen/LLVMCConfigurationEmitter.cpp
@@ -198,7 +198,8 @@
// 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 @@
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 @@
&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 @@
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 @@
}
}
+ 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 << "\")";