[cfe-commits] r149244 - in /cfe/trunk: include/clang/Driver/Options.td test/Driver/target.c

Chandler Carruth chandlerc at gmail.com
Mon Jan 30 04:25:35 PST 2012


Author: chandlerc
Date: Mon Jan 30 06:25:35 2012
New Revision: 149244

URL: http://llvm.org/viewvc/llvm-project?rev=149244&view=rev
Log:
Fix yet another issue introduced when renaming '-ccc-host-triple' to
'-target'. The original flag was part of a flag group that marked it as
driver-only. The new flag didn't ever get equivalent treatment. This
caused the '-target' flag to get passed down to any raw GCC invocation.
Marking it as a driver option fixes this and PR11875.

Added:
    cfe/trunk/test/Driver/target.c
Modified:
    cfe/trunk/include/clang/Driver/Options.td

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=149244&r1=149243&r2=149244&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Mon Jan 30 06:25:35 2012
@@ -756,7 +756,7 @@
 def sub__library : JoinedOrSeparate<"-sub_library">;
 def sub__umbrella : JoinedOrSeparate<"-sub_umbrella">;
 def s : Flag<"-s">;
-def target : Separate<"-target">,
+def target : Separate<"-target">, Flags<[DriverOption]>,
   HelpText<"Generate code for the given target">;
 // We should deprecate the use of -ccc-host-triple, and then remove.
 def ccc_host_triple : Separate<"-ccc-host-triple">, Alias<target>;

Added: cfe/trunk/test/Driver/target.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/target.c?rev=149244&view=auto
==============================================================================
--- cfe/trunk/test/Driver/target.c (added)
+++ cfe/trunk/test/Driver/target.c Mon Jan 30 06:25:35 2012
@@ -0,0 +1,11 @@
+// RUN: %clang -no-canonical-prefixes -target unknown-unknown-unknown -c %s \
+// RUN:   -o %t.o -### 2>&1 | FileCheck %s
+//
+// Ensure we get a crazy triple here as we asked for one.
+// CHECK: Target: unknown-unknown-unknown
+//
+// Also, ensure we don't blindly hand our target selection logic down to GCC.
+// CHECK: "{{.*}}gcc"
+// CHECK-NOT: "-target"
+// CHECK-NOT: "unknown-unknown-unknown"
+// CHECK: "-x" "assembler"





More information about the cfe-commits mailing list