[llvm-commits] CVS: llvm/lib/Support/CommandLine.cpp

Dale Johannesen dalej at apple.com
Tue May 22 10:15:26 PDT 2007



Changes in directory llvm/lib/Support:

CommandLine.cpp updated: 1.87 -> 1.88
---
Log message:

Make tail merging the default, except on powerPC.  There was no prior art
for a target-dependent default with a command-line override; this way
should be generally usable.


---
Diffs of the changes:  (+18 -0)

 CommandLine.cpp |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+)


Index: llvm/lib/Support/CommandLine.cpp
diff -u llvm/lib/Support/CommandLine.cpp:1.87 llvm/lib/Support/CommandLine.cpp:1.88
--- llvm/lib/Support/CommandLine.cpp:1.87	Wed Apr 11 19:36:29 2007
+++ llvm/lib/Support/CommandLine.cpp	Tue May 22 12:14:46 2007
@@ -36,6 +36,7 @@
 // Template instantiations and anchors.
 //
 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<double>);
@@ -50,6 +51,7 @@
 void Option::anchor() {}
 void basic_parser_impl::anchor() {}
 void parser<bool>::anchor() {}
+void parser<boolOrDefault>::anchor() {}
 void parser<int>::anchor() {}
 void parser<unsigned>::anchor() {}
 void parser<double>::anchor() {}
@@ -767,6 +769,22 @@
   return false;
 }
 
+// parser<boolOrDefault> implementation
+//
+bool parser<boolOrDefault>::parse(Option &O, const char *ArgName,
+                         const std::string &Arg, boolOrDefault &Value) {
+  if (Arg == "" || Arg == "true" || Arg == "TRUE" || Arg == "True" ||
+      Arg == "1") {
+    Value = BOU_TRUE;
+  } else if (Arg == "false" || Arg == "FALSE" || Arg == "False" || Arg == "0") {
+    Value = BOU_FALSE;
+  } 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,






More information about the llvm-commits mailing list