diff options
author | Hans Wennborg <hans@hanshq.net> | 2013-08-02 20:16:22 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2013-08-02 20:16:22 +0000 |
commit | d1ddb9afd42774f34a8ebe52713e48e52aa3d4b3 (patch) | |
tree | 13c4161771abff5f8787d0f6a3b81c327f8cf579 /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | 7be35cb1bf520052b051800cee7376a2b9540081 (diff) | |
download | llvm-d1ddb9afd42774f34a8ebe52713e48e52aa3d4b3.zip llvm-d1ddb9afd42774f34a8ebe52713e48e52aa3d4b3.tar.gz llvm-d1ddb9afd42774f34a8ebe52713e48e52aa3d4b3.tar.bz2 |
CC1: Only parse command-line options that have the CC1Option flag.
We already reject flags that don't have the CC1Option flag,
but we would previously do so after parsing the command-line
arguments.
Since the option parser now has a parameter for excluding options,
we should just use that instead.
Differential Revision: http://llvm-reviews.chandlerc.com/D1270
llvm-svn: 187668
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r-- | clang/lib/Frontend/CompilerInvocation.cpp | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index bb7d67a..d362e33 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -1554,9 +1554,11 @@ bool CompilerInvocation::CreateFromArgs(CompilerInvocation &Res, // Parse the arguments. OwningPtr<OptTable> Opts(createDriverOptTable()); + const unsigned IncludedFlagsBitmask = options::CC1Option; unsigned MissingArgIndex, MissingArgCount; OwningPtr<InputArgList> Args( - Opts->ParseArgs(ArgBegin, ArgEnd,MissingArgIndex, MissingArgCount)); + Opts->ParseArgs(ArgBegin, ArgEnd, MissingArgIndex, MissingArgCount, + IncludedFlagsBitmask)); // Check for missing argument error. if (MissingArgCount) { @@ -1572,17 +1574,6 @@ bool CompilerInvocation::CreateFromArgs(CompilerInvocation &Res, Success = false; } - // Issue errors on arguments that are not valid for CC1. - for (ArgList::iterator I = Args->begin(), E = Args->end(); - I != E; ++I) { - if ((*I)->getOption().matches(options::OPT_INPUT)) - continue; - if (!(*I)->getOption().hasFlag(options::CC1Option)) { - Diags.Report(diag::err_drv_unknown_argument) << (*I)->getAsString(*Args); - Success = false; - } - } - Success = ParseAnalyzerArgs(*Res.getAnalyzerOpts(), *Args, Diags) && Success; Success = ParseMigratorArgs(Res.getMigratorOpts(), *Args) && Success; ParseDependencyOutputArgs(Res.getDependencyOutputOpts(), *Args); |