diff options
Diffstat (limited to 'lib/Driver/CC1Options.cpp')
-rw-r--r-- | lib/Driver/CC1Options.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/Driver/CC1Options.cpp b/lib/Driver/CC1Options.cpp index 6f0aa26af7..feadae0a90 100644 --- a/lib/Driver/CC1Options.cpp +++ b/lib/Driver/CC1Options.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// #include "clang/Driver/CC1Options.h" +#include "clang/Basic/Diagnostic.h" #include "clang/Basic/Version.h" #include "clang/Driver/ArgList.h" #include "clang/Driver/Arg.h" @@ -662,7 +663,8 @@ void CompilerInvocation::CreateFromArgs(CompilerInvocation &Res, const char **ArgBegin, const char **ArgEnd, const char *Argv0, - void *MainAddr) { + void *MainAddr, + Diagnostic &Diags) { // Parse the arguments. llvm::OwningPtr<OptTable> Opts(createCC1OptTable()); unsigned MissingArgIndex, MissingArgCount; @@ -678,6 +680,14 @@ void CompilerInvocation::CreateFromArgs(CompilerInvocation &Res, << " value )\n"; } + // Issue errors on unknown arguments. + for (arg_iterator it = InputArgs->filtered_begin(OPT_UNKNOWN), + ie = InputArgs->filtered_end(); it != ie; ++it) { + unsigned ID = Diags.getCustomDiagID(Diagnostic::Error, + "unknown argument: '%0'"); + Diags.Report(ID) << it->getAsString(*InputArgs); + } + ParseAnalyzerArgs(Res.getAnalyzerOpts(), *InputArgs); ParseCodeGenArgs(Res.getCodeGenOpts(), *InputArgs); ParseDependencyOutputArgs(Res.getDependencyOutputOpts(), *InputArgs); |