hopefully unbreak the build by making this-> explicit for dependent
[oota-llvm.git] / include / llvm / Support / CommandLine.h
index 4a7c8c81196edb0b10b78d9de226504e4ab587a3..de12f6fedb49341ddb137ef2b18179059ee677a5 100644 (file)
@@ -25,6 +25,7 @@
 #include "llvm/Support/Compiler.h"
 #include "llvm/ADT/SmallVector.h"
 #include <cassert>
+#include <climits>
 #include <cstdarg>
 #include <string>
 #include <utility>
@@ -126,8 +127,7 @@ enum MiscFlags {               // Miscellaneous flags to adjust argument
   CommaSeparated     = 0x200,  // Should this cl::list split between commas?
   PositionalEatsArgs = 0x400,  // Should this positional cl::list eat -args?
   Sink               = 0x800,  // Should this cl::list eat all unknown options?
-  AllowInverse      = 0x1000, // Can this option take a -Xno- form?
-  MiscMask           = 0x1E00  // Union of the above flags.
+  MiscMask           = 0xE00   // Union of the above flags.
 };
 
 
@@ -473,7 +473,7 @@ public:
         return false;
       }
 
-    return O.error("Cannot find option named '" + ArgVal + "'!");
+    return O.error("Cannot find option named '" + ArgVal + "'!");
   }
 
   /// addLiteralOption - Add an entry to the mapping table.
@@ -537,20 +537,14 @@ struct basic_parser : public basic_parser_impl {
 //
 template<>
 class parser<bool> : public basic_parser<bool> {
-  bool IsInvertable;   // Should we synthezise a -xno- style option?
   const char *ArgStr;
 public:
-  void getExtraOptionNames(std::vector<const char*> &OptionNames);
-  
+
   // parse - Return true on error.
   bool parse(Option &O, const char *ArgName, const std::string &Arg, bool &Val);
 
   template <class Opt>
   void initialize(Opt &O) {
-    if (O.getMiscFlags() & llvm::cl::AllowInverse)
-      IsInvertable = true;
-    else
-      IsInvertable = false;
     ArgStr = O.ArgStr;
   }
 
@@ -685,6 +679,28 @@ public:
 
 EXTERN_TEMPLATE_INSTANTIATION(class basic_parser<std::string>);
 
+//--------------------------------------------------
+// parser<char>
+//
+template<>
+class parser<char> : public basic_parser<char> {
+public:
+  // parse - Return true on error.
+  bool parse(Option &, const char *, const std::string &Arg,
+             char &Value) {
+    Value = Arg[0];
+    return false;
+  }
+
+  // getValueName - Overload in subclass to provide a better default value.
+  virtual const char *getValueName() const { return "char"; }
+
+  // An out-of-line virtual method to provide a 'home' for this class.
+  virtual void anchor();
+};
+
+EXTERN_TEMPLATE_INSTANTIATION(class basic_parser<char>);
+
 //===----------------------------------------------------------------------===//
 // applicator class - This class is used because we must use partial
 // specialization to handle literal string arguments specially (const char* does
@@ -754,7 +770,7 @@ public:
 
   bool setLocation(Option &O, DataType &L) {
     if (Location)
-      return O.error("cl::location(x) specified more than once!");
+      return O.error("cl::location(x) specified more than once!");
     Location = &L;
     return false;
   }
@@ -929,6 +945,7 @@ public:
 EXTERN_TEMPLATE_INSTANTIATION(class opt<unsigned>);
 EXTERN_TEMPLATE_INSTANTIATION(class opt<int>);
 EXTERN_TEMPLATE_INSTANTIATION(class opt<std::string>);
+EXTERN_TEMPLATE_INSTANTIATION(class opt<char>);
 EXTERN_TEMPLATE_INSTANTIATION(class opt<bool>);
 
 //===----------------------------------------------------------------------===//
@@ -947,7 +964,7 @@ public:
 
   bool setLocation(Option &O, StorageClass &L) {
     if (Location)
-      return O.error("cl::location(x) specified more than once!");
+      return O.error("cl::location(x) specified more than once!");
     Location = &L;
     return false;
   }
@@ -1088,7 +1105,7 @@ public:
   }
 };
 
-// multi_arg - Modifier to set the number of additional values.
+// multi_val - Modifier to set the number of additional values.
 struct multi_val {
   unsigned AdditionalVals;
   explicit multi_val(unsigned N) : AdditionalVals(N) {}
@@ -1112,7 +1129,7 @@ class bits_storage {
   template<class T>
   static unsigned Bit(const T &V) {
     unsigned BitPos = reinterpret_cast<unsigned>(V);
-    assert(BitPos < sizeof(unsigned) * 8 &&
+    assert(BitPos < sizeof(unsigned) * CHAR_BIT &&
           "enum exceeds width of bit vector!");
     return 1 << BitPos;
   }
@@ -1122,7 +1139,7 @@ public:
 
   bool setLocation(Option &O, unsigned &L) {
     if (Location)
-      return O.error("cl::location(x) specified more than once!");
+      return O.error("cl::location(x) specified more than once!");
     Location = &L;
     return false;
   }
@@ -1153,7 +1170,7 @@ class bits_storage<DataType, bool> {
   template<class T>
   static unsigned Bit(const T &V) {
     unsigned BitPos = reinterpret_cast<unsigned>(V);
-    assert(BitPos < sizeof(unsigned) * 8 &&
+    assert(BitPos < sizeof(unsigned) * CHAR_BIT &&
           "enum exceeds width of bit vector!");
     return 1 << BitPos;
   }
@@ -1300,15 +1317,15 @@ class alias : public Option {
 
   void done() {
     if (!hasArgStr())
-      error("cl::alias must have argument name specified!");
+      error("cl::alias must have argument name specified!");
     if (AliasFor == 0)
-      error("cl::alias must have an cl::aliasopt(option) specified!");
+      error("cl::alias must have an cl::aliasopt(option) specified!");
       addArgument();
   }
 public:
   void setAliasFor(Option &O) {
     if (AliasFor)
-      error("cl::alias must only have one cl::aliasopt(...) specified!");
+      error("cl::alias must only have one cl::aliasopt(...) specified!");
     AliasFor = &O;
   }
 
@@ -1349,7 +1366,7 @@ struct aliasopt {
 
 // extrahelp - provide additional help at the end of the normal help
 // output. All occurrences of cl::extrahelp will be accumulated and
-// printed to std::cerr at the end of the regular help, just before
+// printed to stderr at the end of the regular help, just before
 // exit is called.
 struct extrahelp {
   const char * morehelp;