[cfe-commits] r69171 - in /cfe/trunk: include/clang/Driver/Driver.h include/clang/Driver/Options.def lib/Driver/Driver.cpp

Daniel Dunbar daniel at zuster.org
Wed Apr 15 09:34:31 PDT 2009


Author: ddunbar
Date: Wed Apr 15 11:34:29 2009
New Revision: 69171

URL: http://llvm.org/viewvc/llvm-project?rev=69171&view=rev
Log:
Driver: Add --help-hidden

Modified:
    cfe/trunk/include/clang/Driver/Driver.h
    cfe/trunk/include/clang/Driver/Options.def
    cfe/trunk/lib/Driver/Driver.cpp

Modified: cfe/trunk/include/clang/Driver/Driver.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Driver.h?rev=69171&r1=69170&r2=69171&view=diff

==============================================================================
--- cfe/trunk/include/clang/Driver/Driver.h (original)
+++ cfe/trunk/include/clang/Driver/Driver.h Wed Apr 15 11:34:29 2009
@@ -163,8 +163,10 @@
   /// PrintActions - Print the list of actions.
   void PrintActions(const Compilation &C) const;
 
-  /// PrintOptions - Print the help text.
-  void PrintHelp() const;
+  /// PrintHelp - Print the help text.
+  ///
+  /// \param ShowHidden - Show hidden options.
+  void PrintHelp(bool ShowHidden) const;
 
   /// PrintOptions - Print the list of arguments.
   void PrintOptions(const ArgList &Args) const;

Modified: cfe/trunk/include/clang/Driver/Options.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.def?rev=69171&r1=69170&r2=69171&view=diff

==============================================================================
--- cfe/trunk/include/clang/Driver/Options.def (original)
+++ cfe/trunk/include/clang/Driver/Options.def Wed Apr 15 11:34:29 2009
@@ -161,6 +161,7 @@
 OPTION("--for-linker", _for_linker, Separate, INVALID, Xlinker, "li", 0, 0, 0)
 OPTION("--force-link=", _force_link_EQ, Joined, INVALID, u, "S", 0, 0, 0)
 OPTION("--force-link", _force_link, Separate, INVALID, u, "", 0, 0, 0)
+OPTION("--help-hidden", _help_hidden, Flag, INVALID, INVALID, "", 0, 0, 0)
 OPTION("--help", _help, Flag, INVALID, INVALID, "", 0, 
        "Display available options", 0)
 OPTION("--imacros=", _imacros_EQ, Joined, INVALID, imacros, "S", 0, 0, 0)

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=69171&r1=69170&r2=69171&view=diff

==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Wed Apr 15 11:34:29 2009
@@ -253,7 +253,7 @@
   return Name;
 }
 
-void Driver::PrintHelp() const {
+void Driver::PrintHelp(bool ShowHidden) const {
   llvm::raw_ostream &OS = llvm::outs();
 
   OS << "OVERVIEW: clang \"gcc-compatible\" driver\n";
@@ -272,9 +272,43 @@
                                           Text));
   }
 
+  if (ShowHidden) {
+    OptionHelp.push_back(std::make_pair("\nDRIVER OPTIONS:",""));
+    OptionHelp.push_back(std::make_pair("-ccc-cxx",
+                                        "Act as a C++ driver"));
+    OptionHelp.push_back(std::make_pair("-ccc-gcc-name",
+                                        "Name for native GCC compiler"));
+    OptionHelp.push_back(std::make_pair("-ccc-clang-cxx",
+                                        "Use the clang compiler for C++"));
+    OptionHelp.push_back(std::make_pair("-ccc-no-clang",
+                                        "Never use the clang compiler"));
+    OptionHelp.push_back(std::make_pair("-ccc-no-clang-cpp",
+                                        "Never use the clang preprocessor"));
+    OptionHelp.push_back(std::make_pair("-ccc-clang-archs",
+                                        "Comma separate list of architectures "
+                                        "to use the clang compiler for"));
+
+    OptionHelp.push_back(std::make_pair("\nDEBUG/DEVELOPMENT OPTIONS:",""));
+    OptionHelp.push_back(std::make_pair("-ccc-host-triple",
+                                        "Simulate running on the given target"));
+    OptionHelp.push_back(std::make_pair("-ccc-print-options",
+                                        "Dump parsed command line arguments"));
+    OptionHelp.push_back(std::make_pair("-ccc-print-phases",
+                                        "Dump list of actions to perform"));
+    OptionHelp.push_back(std::make_pair("-ccc-print-bindings",
+                                        "Show bindings of tools to actions"));
+    OptionHelp.push_back(std::make_pair("CCC_ADD_ARGS",
+                               "(ENVIRONMENT VARIABLE) Comma separated list of "
+                               "arguments to prepend to the command line"));
+  }
+
   // Find the maximum option length. 
   unsigned OptionFieldWidth = 0;
   for (unsigned i = 0, e = OptionHelp.size(); i != e; ++i) {
+    // Skip titles.
+    if (!OptionHelp[i].second)
+      continue;
+
     // Limit the amount of padding we are willing to give up for
     // alignment.
     unsigned Length = OptionHelp[i].first.size();
@@ -329,8 +363,9 @@
     return false;
   }
 
-  if (C.getArgs().hasArg(options::OPT__help)) {
-    PrintHelp();
+  if (C.getArgs().hasArg(options::OPT__help) || 
+      C.getArgs().hasArg(options::OPT__help_hidden)) {
+    PrintHelp(C.getArgs().hasArg(options::OPT__help_hidden));
     return false;
   }
 





More information about the cfe-commits mailing list