Clean up error handling a bit. Add / as a seperator for command line arguments. This is just a big old ugly hack.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@974 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Support/CommandLine.cpp b/lib/Support/CommandLine.cpp
index 76d9e36..07220a6 100644
--- a/lib/Support/CommandLine.cpp
+++ b/lib/Support/CommandLine.cpp
@@ -57,7 +57,8 @@
while (*ArgName == '-') ++ArgName; // Eat leading dashes
const char *ArgNameEnd = ArgName;
- while (*ArgNameEnd && *ArgNameEnd != '=') ++ArgNameEnd; // Scan till end
+ while (*ArgNameEnd && *ArgNameEnd != '=' &&
+ *ArgNameEnd != '/') ++ArgNameEnd; // Scan till end
Value = ArgNameEnd;
if (*Value) // If we have an equals sign...
@@ -72,7 +73,7 @@
if (Handler == 0) {
cerr << "Unknown command line argument '" << argv[i] << "'. Try: "
- << argv[0] << " --help\n'";
+ << argv[0] << " --help'\n";
ErrorParsing = true;
continue;
}
@@ -111,8 +112,10 @@
switch (I->second->getNumOccurancesFlag()) {
case Required:
case OneOrMore:
- if (I->second->getNumOccurances() == 0)
+ if (I->second->getNumOccurances() == 0) {
I->second->error(" must be specified at least once!");
+ ErrorParsing = true;
+ }
// Fall through
default:
break;
diff --git a/support/lib/Support/CommandLine.cpp b/support/lib/Support/CommandLine.cpp
index 76d9e36..07220a6 100644
--- a/support/lib/Support/CommandLine.cpp
+++ b/support/lib/Support/CommandLine.cpp
@@ -57,7 +57,8 @@
while (*ArgName == '-') ++ArgName; // Eat leading dashes
const char *ArgNameEnd = ArgName;
- while (*ArgNameEnd && *ArgNameEnd != '=') ++ArgNameEnd; // Scan till end
+ while (*ArgNameEnd && *ArgNameEnd != '=' &&
+ *ArgNameEnd != '/') ++ArgNameEnd; // Scan till end
Value = ArgNameEnd;
if (*Value) // If we have an equals sign...
@@ -72,7 +73,7 @@
if (Handler == 0) {
cerr << "Unknown command line argument '" << argv[i] << "'. Try: "
- << argv[0] << " --help\n'";
+ << argv[0] << " --help'\n";
ErrorParsing = true;
continue;
}
@@ -111,8 +112,10 @@
switch (I->second->getNumOccurancesFlag()) {
case Required:
case OneOrMore:
- if (I->second->getNumOccurances() == 0)
+ if (I->second->getNumOccurances() == 0) {
I->second->error(" must be specified at least once!");
+ ErrorParsing = true;
+ }
// Fall through
default:
break;