From d64e0eb094a108bdcdf51328425904042aa6122b Mon Sep 17 00:00:00 2001 From: Mike Stump Date: Mon, 2 Feb 2009 22:48:49 +0000 Subject: 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63559 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Support/CommandLine.cpp | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) (limited to 'lib/Support/CommandLine.cpp') diff --git a/lib/Support/CommandLine.cpp b/lib/Support/CommandLine.cpp index e06f324c87..2c56e0ffb8 100644 --- a/lib/Support/CommandLine.cpp +++ b/lib/Support/CommandLine.cpp @@ -40,7 +40,6 @@ using namespace cl; // TEMPLATE_INSTANTIATION(class basic_parser); TEMPLATE_INSTANTIATION(class basic_parser); -TEMPLATE_INSTANTIATION(class basic_parser); TEMPLATE_INSTANTIATION(class basic_parser); TEMPLATE_INSTANTIATION(class basic_parser); TEMPLATE_INSTANTIATION(class basic_parser); @@ -56,7 +55,6 @@ void Option::anchor() {} void basic_parser_impl::anchor() {} void parser::anchor() {} void parser::anchor() {} -void parser::anchor() {} void parser::anchor() {} void parser::anchor() {} void parser::anchor() {} @@ -874,6 +872,8 @@ bool parser::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::parse(Option &O, const char *ArgName, return false; } -// parser implementation -// -bool parser::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 implementation // bool parser::parse(Option &O, const char *ArgName, -- cgit v1.2.3