diff options
| -rw-r--r-- | llvm/include/llvm/Support/CommandLine.h | 22 | ||||
| -rw-r--r-- | llvm/lib/Support/CommandLine.cpp | 13 | 
2 files changed, 35 insertions, 0 deletions
diff --git a/llvm/include/llvm/Support/CommandLine.h b/llvm/include/llvm/Support/CommandLine.h index ba8fbee94fd..c6b62a8df9a 100644 --- a/llvm/include/llvm/Support/CommandLine.h +++ b/llvm/include/llvm/Support/CommandLine.h @@ -806,6 +806,28 @@ public:  EXTERN_TEMPLATE_INSTANTIATION(class basic_parser<unsigned>);  //-------------------------------------------------- +// parser<unsigned long long> +// +template<> +class parser<unsigned long long> : public basic_parser<unsigned long long> { +public: +  // parse - Return true on error. +  bool parse(Option &O, StringRef ArgName, StringRef Arg, +             unsigned long long &Val); + +  // getValueName - Overload in subclass to provide a better default value. +  virtual const char *getValueName() const { return "uint"; } + +  void printOptionDiff(const Option &O, unsigned long long V, OptVal Default, +                       size_t GlobalWidth) const; + +  // An out-of-line virtual method to provide a 'home' for this class. +  virtual void anchor(); +}; + +EXTERN_TEMPLATE_INSTANTIATION(class basic_parser<unsigned long long>); + +//--------------------------------------------------  // parser<double>  //  template<> diff --git a/llvm/lib/Support/CommandLine.cpp b/llvm/lib/Support/CommandLine.cpp index 839ec799d80..238adcce0a1 100644 --- a/llvm/lib/Support/CommandLine.cpp +++ b/llvm/lib/Support/CommandLine.cpp @@ -44,6 +44,7 @@ TEMPLATE_INSTANTIATION(class basic_parser<bool>);  TEMPLATE_INSTANTIATION(class basic_parser<boolOrDefault>);  TEMPLATE_INSTANTIATION(class basic_parser<int>);  TEMPLATE_INSTANTIATION(class basic_parser<unsigned>); +TEMPLATE_INSTANTIATION(class basic_parser<unsigned long long>);  TEMPLATE_INSTANTIATION(class basic_parser<double>);  TEMPLATE_INSTANTIATION(class basic_parser<float>);  TEMPLATE_INSTANTIATION(class basic_parser<std::string>); @@ -62,6 +63,7 @@ void parser<bool>::anchor() {}  void parser<boolOrDefault>::anchor() {}  void parser<int>::anchor() {}  void parser<unsigned>::anchor() {} +void parser<unsigned long long>::anchor() {}  void parser<double>::anchor() {}  void parser<float>::anchor() {}  void parser<std::string>::anchor() {} @@ -1005,6 +1007,16 @@ bool parser<unsigned>::parse(Option &O, StringRef ArgName,    return false;  } +// parser<unsigned long long> implementation +// +bool parser<unsigned long long>::parse(Option &O, StringRef ArgName, +                                      StringRef Arg, unsigned long long &Value){ + +  if (Arg.getAsInteger(0, Value)) +    return O.error("'" + Arg + "' value invalid for uint argument!"); +  return false; +} +  // parser<double>/parser<float> implementation  //  static bool parseDouble(Option &O, StringRef Arg, double &Value) { @@ -1150,6 +1162,7 @@ PRINT_OPT_DIFF(bool)  PRINT_OPT_DIFF(boolOrDefault)  PRINT_OPT_DIFF(int)  PRINT_OPT_DIFF(unsigned) +PRINT_OPT_DIFF(unsigned long long)  PRINT_OPT_DIFF(double)  PRINT_OPT_DIFF(float)  PRINT_OPT_DIFF(char)  | 

