llvm.org GIT mirror llvm / b351456
CommandLine: Add support for 64 bit unsigned integer options. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139848 91177308-0d34-0410-b5e6-96231b3b80d8 Benjamin Kramer 8 years ago
2 changed file(s) with 35 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
805805 EXTERN_TEMPLATE_INSTANTIATION(class basic_parser);
806806
807807 //--------------------------------------------------
808 // parser
809 //
810 template<>
811 class parser : public basic_parser {
812 public:
813 // parse - Return true on error.
814 bool parse(Option &O, StringRef ArgName, StringRef Arg,
815 unsigned long long &Val);
816
817 // getValueName - Overload in subclass to provide a better default value.
818 virtual const char *getValueName() const { return "uint"; }
819
820 void printOptionDiff(const Option &O, unsigned long long V, OptVal Default,
821 size_t GlobalWidth) const;
822
823 // An out-of-line virtual method to provide a 'home' for this class.
824 virtual void anchor();
825 };
826
827 EXTERN_TEMPLATE_INSTANTIATION(class basic_parser);
828
829 //--------------------------------------------------
808830 // parser
809831 //
810832 template<>
4343 TEMPLATE_INSTANTIATION(class basic_parser);
4444 TEMPLATE_INSTANTIATION(class basic_parser);
4545 TEMPLATE_INSTANTIATION(class basic_parser);
46 TEMPLATE_INSTANTIATION(class basic_parser);
4647 TEMPLATE_INSTANTIATION(class basic_parser);
4748 TEMPLATE_INSTANTIATION(class basic_parser);
4849 TEMPLATE_INSTANTIATION(class basic_parser);
6162 void parser::anchor() {}
6263 void parser::anchor() {}
6364 void parser::anchor() {}
65 void parser::anchor() {}
6466 void parser::anchor() {}
6567 void parser::anchor() {}
6668 void parser::anchor() {}
10041006 return false;
10051007 }
10061008
1009 // parser implementation
1010 //
1011 bool parser::parse(Option &O, StringRef ArgName,
1012 StringRef Arg, unsigned long long &Value){
1013
1014 if (Arg.getAsInteger(0, Value))
1015 return O.error("'" + Arg + "' value invalid for uint argument!");
1016 return false;
1017 }
1018
10071019 // parser/parser implementation
10081020 //
10091021 static bool parseDouble(Option &O, StringRef Arg, double &Value) {
11491161 PRINT_OPT_DIFF(boolOrDefault)
11501162 PRINT_OPT_DIFF(int)
11511163 PRINT_OPT_DIFF(unsigned)
1164 PRINT_OPT_DIFF(unsigned long long)
11521165 PRINT_OPT_DIFF(double)
11531166 PRINT_OPT_DIFF(float)
11541167 PRINT_OPT_DIFF(char)