[driver] In general, the driver claims redundant args and uses the last arg.

However, the '-x' option has special handling and wasn't following this
paradigm.  Fix it to do so by claiming the arg as we parse the '-x' option.
rdar://11203340

llvm-svn: 154231
This commit is contained in:
Chad Rosier 2012-04-07 00:01:31 +00:00
parent 372787fc19
commit 706c235013
2 changed files with 3 additions and 0 deletions

View File

@ -1003,6 +1003,7 @@ void Driver::BuildInputs(const ToolChain &TC, const DerivedArgList &Args,
} else if (A->getOption().matches(options::OPT_x)) {
InputTypeArg = A;
InputType = types::lookupTypeForTypeSpecifier(A->getValue(Args));
A->claim();
// Follow gcc behavior and treat as linker input for invalid -x
// options. Its not clear why we shouldn't just revert to unknown; but

View File

@ -0,0 +1,2 @@
// RUN: %clang -target x86_64-apple-darwin10 \
// RUN: -Werror -x c -x c -fsyntax-only %s