[llvm-commits] [llvm] r60198 - in /llvm/trunk: include/llvm/CompilerDriver/Common.td tools/llvmc/doc/LLVMC-Reference.rst utils/TableGen/LLVMCConfigurationEmitter.cpp

Mikhail Glushenkov foldr at codedgers.com
Thu Nov 27 16:13:26 PST 2008


Author: foldr
Date: Thu Nov 27 18:13:25 2008
New Revision: 60198

URL: http://llvm.org/viewvc/llvm-project?rev=60198&view=rev
Log:
Add 'hidden' and 'really_hidden' option properties.

Modified:
    llvm/trunk/include/llvm/CompilerDriver/Common.td
    llvm/trunk/tools/llvmc/doc/LLVMC-Reference.rst
    llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp

Modified: llvm/trunk/include/llvm/CompilerDriver/Common.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CompilerDriver/Common.td?rev=60198&r1=60197&r2=60198&view=diff

==============================================================================
--- llvm/trunk/include/llvm/CompilerDriver/Common.td (original)
+++ llvm/trunk/include/llvm/CompilerDriver/Common.td Thu Nov 27 18:13:25 2008
@@ -38,10 +38,12 @@
 def append_cmd;
 def forward;
 def forward_as;
-def stop_compilation;
-def unpack_values;
 def help;
+def hidden;
+def really_hidden;
 def required;
+def stop_compilation;
+def unpack_values;
 
 // Empty DAG marker.
 def empty;

Modified: llvm/trunk/tools/llvmc/doc/LLVMC-Reference.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc/doc/LLVMC-Reference.rst?rev=60198&r1=60197&r2=60198&view=diff

==============================================================================
--- llvm/trunk/tools/llvmc/doc/LLVMC-Reference.rst (original)
+++ llvm/trunk/tools/llvmc/doc/LLVMC-Reference.rst Thu Nov 27 18:13:25 2008
@@ -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
 ======================================================

Modified: llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp?rev=60198&r1=60197&r2=60198&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp Thu Nov 27 18:13:25 2008
@@ -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 << "\")";
 





More information about the llvm-commits mailing list