diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-03-22 23:26:43 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-03-22 23:26:43 +0000 |
commit | b0c4df5c4df69a003f26b378eb95961bc7c486e5 (patch) | |
tree | 2366feb7fa7499a78e8a7244b6670a36077068f7 /lib/Driver/Driver.cpp | |
parent | 5fdeae17da443c50c62f602733d06193a71b170f (diff) |
Driver: Implement 'missing argument' error.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67490 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/Driver.cpp')
-rw-r--r-- | lib/Driver/Driver.cpp | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp index 40c6e50063..db084262e9 100644 --- a/lib/Driver/Driver.cpp +++ b/lib/Driver/Driver.cpp @@ -72,18 +72,23 @@ ArgList *Driver::ParseArgStrings(const char **ArgBegin, const char **ArgEnd) { } unsigned Prev = Index; - Arg *A = getOpts().ParseOneArg(*Args, Index, End); - if (A) { - if (A->getOption().isUnsupported()) { - Diag(clang::diag::err_drv_unsupported_opt) << A->getAsString(*Args); - continue; - } + Arg *A = getOpts().ParseOneArg(*Args, Index); + assert(Index > Prev && "Parser failed to consume argument."); - Args->append(A); + // Check for missing argument error. + if (!A) { + assert(Index >= End && "Unexpected parser error."); + Diag(clang::diag::err_drv_missing_argument) + << Args->getArgString(Prev) + << (Index - Prev - 1); + break; } - assert(Index > Prev && "Parser failed to consume argument."); - (void) Prev; + if (A->getOption().isUnsupported()) { + Diag(clang::diag::err_drv_unsupported_opt) << A->getAsString(*Args); + continue; + } + Args->append(A); } return Args; |