[cfe-commits] r154231 - in /cfe/trunk: lib/Driver/Driver.cpp test/Driver/redundant-args.c

Chad Rosier mcrosier at apple.com
Fri Apr 6 17:01:31 PDT 2012


Author: mcrosier
Date: Fri Apr  6 19:01:31 2012
New Revision: 154231

URL: http://llvm.org/viewvc/llvm-project?rev=154231&view=rev
Log:
[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

Added:
    cfe/trunk/test/Driver/redundant-args.c
Modified:
    cfe/trunk/lib/Driver/Driver.cpp

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=154231&r1=154230&r2=154231&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Fri Apr  6 19:01:31 2012
@@ -1003,6 +1003,7 @@
     } 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

Added: cfe/trunk/test/Driver/redundant-args.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/redundant-args.c?rev=154231&view=auto
==============================================================================
--- cfe/trunk/test/Driver/redundant-args.c (added)
+++ cfe/trunk/test/Driver/redundant-args.c Fri Apr  6 19:01:31 2012
@@ -0,0 +1,2 @@
+// RUN: %clang -target x86_64-apple-darwin10 \
+// RUN:   -Werror -x c -x c -fsyntax-only %s





More information about the cfe-commits mailing list