Driver: Add extra parameters for help text to option definitions.
 - Currently unused.

And yes, now may be about the time I want a TableGen backend.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68139 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Driver/OptTable.cpp b/lib/Driver/OptTable.cpp
index 2e44999..4c198fc 100644
--- a/lib/Driver/OptTable.cpp
+++ b/lib/Driver/OptTable.cpp
@@ -21,6 +21,8 @@
 struct Info {
   const char *Name;
   const char *Flags;
+  const char *HelpText;
+  const char *MetaVar;
 
   Option::OptionClass Kind;
   unsigned GroupID;
@@ -72,12 +74,14 @@
 
 static Info OptionInfos[] = {
   // The InputOption info
-  { "<input>", "d", Option::InputClass, OPT_INVALID, OPT_INVALID, 0 },
+  { "<input>", "d", 0, 0, Option::InputClass, OPT_INVALID, OPT_INVALID, 0 },
   // The UnknownOption info
-  { "<unknown>", "", Option::UnknownClass, OPT_INVALID, OPT_INVALID, 0 },
+  { "<unknown>", "", 0, 0, Option::UnknownClass, OPT_INVALID, OPT_INVALID, 0 },
   
-#define OPTION(NAME, ID, KIND, GROUP, ALIAS, FLAGS, PARAM)              \
-  { NAME, FLAGS, Option::KIND##Class, OPT_##GROUP, OPT_##ALIAS, PARAM },
+#define OPTION(NAME, ID, KIND, GROUP, ALIAS, FLAGS, PARAM, \
+               HELPTEXT, METAVAR)   \
+  { NAME, FLAGS, HELPTEXT, METAVAR, \
+    Option::KIND##Class, OPT_##GROUP, OPT_##ALIAS, PARAM },
 #include "clang/Driver/Options.def"
 };
 static const unsigned numOptions = sizeof(OptionInfos) / sizeof(OptionInfos[0]);
@@ -133,6 +137,16 @@
   return getInfo(id).Name;
 }
 
+const char *OptTable::getOptionHelpText(options::ID id) const {
+  return getInfo(id).HelpText;
+}
+
+const char *OptTable::getOptionMetaVar(options::ID id) const {
+  const char *Name = getInfo(id).MetaVar;
+  // FIXME: This will need translation.
+  return Name ? Name : "<var>";
+}
+
 const Option *OptTable::getOption(options::ID id) const {
   if (id == OPT_INVALID)
     return 0;