mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[frontend] Updated CompilerInvocation::parseArgs() so that it emits a diagnostic when it encounters an unknown argument.
Added a test which ensures that the driver invokes the integrated frontend in a way which does not produce any errors, in order to catch mismatches between the options the driver passes to the integrated frontend and the options which the integrated frontend accepts. Swift SVN r11105
This commit is contained in:
@@ -55,6 +55,8 @@ bool CompilerInvocation::parseArgs(ArrayRef<const char *> Args,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool HasUnknownArgument = false;
|
||||
|
||||
for (auto InputArg : *ParsedArgs) {
|
||||
switch (InputArg->getOption().getID()) {
|
||||
case OPT_target:
|
||||
@@ -120,8 +122,14 @@ bool CompilerInvocation::parseArgs(ArrayRef<const char *> Args,
|
||||
case OPT_INPUT:
|
||||
addInputFilename(InputArg->getValue());
|
||||
break;
|
||||
|
||||
default:
|
||||
HasUnknownArgument = true;
|
||||
Diags.diagnose(SourceLoc(), diag::error_unknown_arg,
|
||||
InputArg->getAsString(*ParsedArgs));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return HasUnknownArgument;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user