aboutsummaryrefslogtreecommitdiff
path: root/support
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-07-25 18:40:49 +0000
committerChris Lattner <sabre@nondot.org>2001-07-25 18:40:49 +0000
commit3805e4ccfa6b908c5035256ea6ee51e219f029db (patch)
treece32dc0d5ef4b09ee0c8eb29eb2184755a4eb0a6 /support
parentb2d11bad7e8daf2a5581cce7d394ffd0c6bb7a01 (diff)
Fixed a bug exposed when doing something like this: <program> -notanoption --help
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'support')
-rw-r--r--support/lib/Support/CommandLine.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/support/lib/Support/CommandLine.cpp b/support/lib/Support/CommandLine.cpp
index db2c3f373f..0584590688 100644
--- a/support/lib/Support/CommandLine.cpp
+++ b/support/lib/Support/CommandLine.cpp
@@ -49,7 +49,8 @@ void cl::ParseCommandLineOptions(int &argc, char **argv,
const char *Value = "";
const char *ArgName = "";
if (argv[i][0] != '-') { // Unnamed argument?
- Handler = getOpts()[""];
+ map<string, Option*>::iterator I = getOpts().find("");
+ Handler = I != getOpts().end() ? I->second : 0;
Value = argv[i];
} else { // We start with a - or --, eat dashes
ArgName = argv[i]+1;
@@ -63,8 +64,9 @@ void cl::ParseCommandLineOptions(int &argc, char **argv,
++Value; // Advance to value...
if (*ArgName != 0) {
- string ArgNameStr(ArgName, ArgNameEnd); // Extract arg name part
- Handler = getOpts()[ArgNameStr];
+ // Extract arg name part
+ map<string, Option*>::iterator I = getOpts().find(string(ArgName, ArgNameEnd));
+ Handler = I != getOpts().end() ? I->second : 0;
}
}