diff options
-rw-r--r-- | include/llvm/Support/CommandLine.h | 23 | ||||
-rw-r--r-- | lib/Support/CommandLine.cpp | 3 |
2 files changed, 26 insertions, 0 deletions
diff --git a/include/llvm/Support/CommandLine.h b/include/llvm/Support/CommandLine.h index 1b62558..fa3b870 100644 --- a/include/llvm/Support/CommandLine.h +++ b/include/llvm/Support/CommandLine.h @@ -679,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 @@ -923,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>); //===----------------------------------------------------------------------===// diff --git a/lib/Support/CommandLine.cpp b/lib/Support/CommandLine.cpp index e4f65ba..4922560 100644 --- a/lib/Support/CommandLine.cpp +++ b/lib/Support/CommandLine.cpp @@ -45,10 +45,12 @@ TEMPLATE_INSTANTIATION(class basic_parser<unsigned>); TEMPLATE_INSTANTIATION(class basic_parser<double>); TEMPLATE_INSTANTIATION(class basic_parser<float>); TEMPLATE_INSTANTIATION(class basic_parser<std::string>); +TEMPLATE_INSTANTIATION(class basic_parser<char>); TEMPLATE_INSTANTIATION(class opt<unsigned>); TEMPLATE_INSTANTIATION(class opt<int>); TEMPLATE_INSTANTIATION(class opt<std::string>); +TEMPLATE_INSTANTIATION(class opt<char>); TEMPLATE_INSTANTIATION(class opt<bool>); void Option::anchor() {} @@ -60,6 +62,7 @@ void parser<unsigned>::anchor() {} void parser<double>::anchor() {} void parser<float>::anchor() {} void parser<std::string>::anchor() {} +void parser<char>::anchor() {} //===----------------------------------------------------------------------===// |