diff options
author | Mike Stump <mrs@apple.com> | 2009-02-02 22:48:49 +0000 |
---|---|---|
committer | Mike Stump <mrs@apple.com> | 2009-02-02 22:48:49 +0000 |
commit | b92f839f9c2b961bc92601eda81bed503997a811 (patch) | |
tree | 4ae0f14b5cbfdd7b1b8fa55b856925864512bf1d /llvm/lib/Support/CommandLine.cpp | |
parent | 4eda2cbe5f554ec6f6a3884747004caac8d86ec4 (diff) | |
download | bcm5719-llvm-b92f839f9c2b961bc92601eda81bed503997a811.tar.gz bcm5719-llvm-b92f839f9c2b961bc92601eda81bed503997a811.zip |
Improve -fno-opt style option processing to not require an extra
option to make the -fno- form on the option. We also document the new
form in the CommandLine documentation.
llvm-svn: 63559
Diffstat (limited to 'llvm/lib/Support/CommandLine.cpp')
-rw-r--r-- | llvm/lib/Support/CommandLine.cpp | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/llvm/lib/Support/CommandLine.cpp b/llvm/lib/Support/CommandLine.cpp index e06f324c871..2c56e0ffb87 100644 --- a/llvm/lib/Support/CommandLine.cpp +++ b/llvm/lib/Support/CommandLine.cpp @@ -40,7 +40,6 @@ using namespace cl; // TEMPLATE_INSTANTIATION(class basic_parser<bool>); TEMPLATE_INSTANTIATION(class basic_parser<boolOrDefault>); -TEMPLATE_INSTANTIATION(class basic_parser<boolInverse>); TEMPLATE_INSTANTIATION(class basic_parser<int>); TEMPLATE_INSTANTIATION(class basic_parser<unsigned>); TEMPLATE_INSTANTIATION(class basic_parser<double>); @@ -56,7 +55,6 @@ void Option::anchor() {} void basic_parser_impl::anchor() {} void parser<bool>::anchor() {} void parser<boolOrDefault>::anchor() {} -void parser<boolInverse>::anchor() {} void parser<int>::anchor() {} void parser<unsigned>::anchor() {} void parser<double>::anchor() {} @@ -874,6 +872,8 @@ bool parser<bool>::parse(Option &O, const char *ArgName, return O.error(": '" + Arg + "' is invalid value for boolean argument! Try 0 or 1"); } + if (IsInvertable && strncmp(ArgName+1, "no-", 3) == 0) + Value = !Value; return false; } @@ -894,23 +894,6 @@ bool parser<boolOrDefault>::parse(Option &O, const char *ArgName, return false; } -// parser<boolInverse> implementation -// -bool parser<boolInverse>::parse(Option &O, const char *ArgName, - const std::string &Arg, bool &Value) { - if (Arg == "" || Arg == "true" || Arg == "TRUE" || Arg == "True" || - Arg == "1") { - Value = false; - } else if (Arg == "false" || Arg == "FALSE" - || Arg == "False" || Arg == "0") { - Value = true; - } else { - return O.error(": '" + Arg + - "' is invalid value for boolean argument! Try 0 or 1"); - } - return false; -} - // parser<int> implementation // bool parser<int>::parse(Option &O, const char *ArgName, |