r231787 - Allow -target= and --target options

Renato Golin renato.golin at linaro.org
Tue Mar 10 06:58:34 PDT 2015


Author: rengolin
Date: Tue Mar 10 08:58:33 2015
New Revision: 231787

URL: http://llvm.org/viewvc/llvm-project?rev=231787&view=rev
Log:
Allow -target= and --target options

Using clang as a cross-compiler with the 'target' option could be confusing
for those inexperienced in the realm of cross compiling.

This patch would allow the use of all these four variants of the target option:
-target <triple>
--target <triple>
-target=<triple>
--target=<triple>

Patch by Gabor Ballabas.

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

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=231787&r1=231786&r2=231787&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Tue Mar 10 08:58:33 2015
@@ -1540,7 +1540,7 @@ def no_system_header_prefix : Joined<["-
            "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">;
@@ -1713,7 +1713,7 @@ def mv5 : Flag<["-"], "mv5">, Group<m_he
 // 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">,

Modified: cfe/trunk/test/Driver/target.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/target.c?rev=231787&r1=231786&r2=231787&view=diff
==============================================================================
--- cfe/trunk/test/Driver/target.c (original)
+++ cfe/trunk/test/Driver/target.c Tue Mar 10 08:58:33 2015
@@ -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





More information about the cfe-commits mailing list