aboutsummaryrefslogtreecommitdiff
path: root/lib/Driver/Driver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Driver/Driver.cpp')
-rw-r--r--lib/Driver/Driver.cpp23
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;