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 | 4ed47ccf892de9b725f64d6cfc309f0461105ba5 (patch) | |
| tree | 361ffd66fe0a7150592ca54fb34ad3d7eb31d12a /lib/Frontend/CompilerInvocation.cpp | |
| parent | f647b69147c6e640bbccf501783fafc495bbefb2 (diff) | |
| download | clang-4ed47ccf892de9b725f64d6cfc309f0461105ba5.tar.gz clang-4ed47ccf892de9b725f64d6cfc309f0461105ba5.tar.bz2 clang-4ed47ccf892de9b725f64d6cfc309f0461105ba5.tar.xz | |
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
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187668 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/CompilerInvocation.cpp')
| -rw-r--r-- | lib/Frontend/CompilerInvocation.cpp | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index bb7d67ae37..d362e33ef9 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/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); |
