[PATCH] Make the driver accept all four variants of the target option

Gabor Ballabas gaborb at inf.u-szeged.hu
Mon Mar 2 09:14:15 PST 2015


Hi Richard,

I uploaded a new patch with the changes you requested.

Thanks,
Gabor


http://reviews.llvm.org/D7730

Files:
  include/clang/Driver/Options.td
  test/Driver/target.c

Index: include/clang/Driver/Options.td
===================================================================
--- include/clang/Driver/Options.td
+++ include/clang/Driver/Options.td
@@ -1531,7 +1531,7 @@
            "system header.">;
 def : Separate<["--"], "no-system-header-prefix">, Alias<no_system_header_prefix>;
 def s : Flag<["-"], "s">;
-def target : Joined<["--"], "target=">, Flags<[DriverOption, CoreOption]>,
+def target : Joined<["-", "--"], "target=">, Flags<[DriverOption, CoreOption]>,
   HelpText<"Generate code for the given target">;
 def gcc_toolchain : Joined<["--"], "gcc-toolchain=">, Flags<[DriverOption]>,
   HelpText<"Use the gcc toolchain at the given directory">;
@@ -1704,7 +1704,7 @@
 // aliases for options that are spelled using the more common Unix / GNU flag
 // style of double-dash and equals-joined flags.
 def gcc_toolchain_legacy_spelling : Separate<["-"], "gcc-toolchain">, Alias<gcc_toolchain>;
-def target_legacy_spelling : Separate<["-"], "target">, Alias<target>;
+def target_legacy_spelling : Separate<["-", "--"], "target">, Alias<target>;
 
 // Special internal option to handle -Xlinker --no-demangle.
 def Z_Xlinker__no_demangle : Flag<["-"], "Z-Xlinker-no-demangle">,
Index: test/Driver/target.c
===================================================================
--- test/Driver/target.c
+++ test/Driver/target.c
@@ -7,3 +7,9 @@
 // Also check that the legacy spelling works.
 // RUN: %clang -no-canonical-prefixes -target unknown-unknown-unknown -c %s \
 // RUN:   -o %t.o -### 2>&1 | FileCheck %s
+//
+// RUN: %clang -no-canonical-prefixes -target=unknown-unknown-unknown -c %s \
+// RUN:   -o %t.o -### 2>&1 | FileCheck %s
+//
+// RUN: %clang -no-canonical-prefixes --target unknown-unknown-unknown -c %s \
+// RUN:   -o %t.o -### 2>&1 | FileCheck %s

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7730.21011.patch
Type: text/x-patch
Size: 1803 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150302/96b5dd64/attachment.bin>


More information about the cfe-commits mailing list