r187668 - CC1: Only parse command-line options that have the CC1Option flag.
Hans Wennborg
hans at hanshq.net
Fri Aug 2 13:16:22 PDT 2013
Author: hans
Date: Fri Aug 2 15:16:22 2013
New Revision: 187668
URL: http://llvm.org/viewvc/llvm-project?rev=187668&view=rev
Log:
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
Modified:
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/test/Headers/altivec-header.c
Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=187668&r1=187667&r2=187668&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Fri Aug 2 15:16:22 2013
@@ -1554,9 +1554,11 @@ bool CompilerInvocation::CreateFromArgs(
// 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(
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);
Modified: cfe/trunk/test/Headers/altivec-header.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Headers/altivec-header.c?rev=187668&r1=187667&r2=187668&view=diff
==============================================================================
--- cfe/trunk/test/Headers/altivec-header.c (original)
+++ cfe/trunk/test/Headers/altivec-header.c Fri Aug 2 15:16:22 2013
@@ -1,7 +1,7 @@
// REQUIRES: ppc64-registered-target
-// RUN: %clang_cc1 -triple powerpc64-unknown-unknown -maltivec -ffreestanding -S -o - %s | FileCheck %s
-// RUN: %clang_cc1 -triple powerpc64-unknown-unknown -maltivec -ffreestanding -fno-lax-vector-conversions -S -o - %s | FileCheck %s
-// RUN: %clang_cc1 -triple powerpc64-unknown-unknown -maltivec -ffreestanding -x c++ -S -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple powerpc64-unknown-unknown -faltivec -ffreestanding -S -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple powerpc64-unknown-unknown -faltivec -ffreestanding -fno-lax-vector-conversions -S -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple powerpc64-unknown-unknown -faltivec -ffreestanding -x c++ -S -o - %s | FileCheck %s
#include <altivec.h>
More information about the cfe-commits
mailing list