diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-03-13 01:01:44 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-03-13 01:01:44 +0000 |
commit | 4139340644a0a41c2529c183c4b60bb55c3fdc79 (patch) | |
tree | 679b007faae71fac2e498619523c55d4059bad5a | |
parent | cb881672c2c46142ec1bdfa401c9818ae805db0f (diff) |
Driver: Ignore empty arguments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66858 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Driver/Driver.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp index c8750f7449..4fc03ce765 100644 --- a/lib/Driver/Driver.cpp +++ b/lib/Driver/Driver.cpp @@ -45,6 +45,16 @@ ArgList *Driver::ParseArgStrings(const char **ArgBegin, const char **ArgEnd) { unsigned Index = 0, End = ArgEnd - ArgBegin; while (Index < End) { + // gcc's handling of empty arguments doesn't make + // sense, but this is not a common use case. :) + // + // We just ignore them here (note that other things may + // still take them as arguments). + if (Args->getArgString(Index)[0] == '\0') { + ++Index; + continue; + } + unsigned Prev = Index; Arg *A = getOpts().ParseOneArg(*Args, Index, End); if (A) { @@ -209,7 +219,7 @@ bool Driver::HandleImmediateArgs(const ArgList &Args) { return false; } - if (Arg *A = Args.getLastArg(options::OPT_print_libgcc_file_name)) { + if (Args.hasArg(options::OPT_print_libgcc_file_name)) { llvm::outs() << GetProgramPath("libgcc.a").toString() << "\n"; return false; } |