Regularize the names of #include-guards.
[oota-llvm.git] / include / Support / CommandLine.h
index 23a12855439ec6fcb4e6791e93f28df04edfe4b6..728bb1467835f71e9a886e6f92e4dc27b161e035 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_SUPPORT_COMMANDLINE_H
-#define LLVM_SUPPORT_COMMANDLINE_H
+#ifndef SUPPORT_COMMANDLINE_H
+#define SUPPORT_COMMANDLINE_H
 
 #include <string>
 #include <vector>
 #include <utility>
-#include <stdarg.h>
+#include <cstdarg>
 #include "boost/type_traits/object_traits.hpp"
 
-namespace cl {   // Short namespace to make usage concise
+#include <assert.h>
+
+/// cl Namespace - This namespace contains all of the command line option
+/// processing machinery.  It is intentionally a short name to make qualified
+/// usage concise.
+namespace cl {
 
 //===----------------------------------------------------------------------===//
 // ParseCommandLineOptions - Command line option processing entry point.
@@ -50,7 +55,7 @@ enum NumOccurances {           // Flags for the number of occurances allowed...
 };
 
 enum ValueExpected {           // Is a value required for the option?
-  ValueOptional   = 0x08,      // The value can oppear... or not
+  ValueOptional   = 0x08,      // The value can appear... or not
   ValueRequired   = 0x10,      // The value is required to appear!
   ValueDisallowed = 0x18,      // A value may not be specified (for flags)
   ValueMask       = 0x18,
@@ -86,6 +91,12 @@ enum FormattingFlags {
   FormattingMask   = 0x180,
 };
 
+enum MiscFlags {                // Miscellaneous flags to adjust argument
+  CommaSeparated   = 0x200,     // Should this cl::list split between commas?
+  MiscMask         = 0x200,
+};
+
+
 
 //===----------------------------------------------------------------------===//
 // Option Base class
@@ -137,6 +148,9 @@ public:
     int OH = Flags & FormattingMask;
     return OH ? (enum FormattingFlags)OH : getFormattingFlagDefault();
   }
+  inline unsigned getMiscFlags() const {
+    return Flags & MiscMask;
+  }
 
   // hasArgStr - Return true if the argstr != ""
   bool hasArgStr() const { return ArgStr[0] != 0; }
@@ -163,7 +177,7 @@ public:
   void setValueExpectedFlag(enum ValueExpected Val) { setFlag(Val, ValueMask); }
   void setHiddenFlag(enum OptionHidden Val) { setFlag(Val, HiddenMask); }
   void setFormattingFlag(enum FormattingFlags V) { setFlag(V, FormattingMask); }
-
+  void setMiscFlag(enum MiscFlags M) { setFlag(M, M); }
 protected:
   Option() : NumOccurances(0), Flags(0),
              ArgStr(""), HelpStr(""), ValueStr("") {}
@@ -583,6 +597,9 @@ template<> struct applicator<OptionHidden> {
 template<> struct applicator<FormattingFlags> {
   static void opt(FormattingFlags FF, Option &O) { O.setFormattingFlag(FF); }
 };
+template<> struct applicator<MiscFlags> {
+  static void opt(MiscFlags MF, Option &O) { O.setMiscFlag(MF); }
+};
 
 // apply method - Apply a modifier to an option in a type safe way.
 template<class Mod, class Opt>