[clang] 8baa076 - [clang-cl] Accept the "legacy" -target flag spelling

Hans Wennborg via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 10 09:27:47 PST 2022


Author: Hans Wennborg
Date: 2022-02-10T18:27:30+01:00
New Revision: 8baa076dffa381baa1f190356b4be5b0cc3bf13e

URL: https://github.com/llvm/llvm-project/commit/8baa076dffa381baa1f190356b4be5b0cc3bf13e
DIFF: https://github.com/llvm/llvm-project/commit/8baa076dffa381baa1f190356b4be5b0cc3bf13e.diff

LOG: [clang-cl] Accept the "legacy" -target flag spelling

we already accept "--target=". No reason to not accept "-target" too
(that's the one I typically use for some reason).

Differential revision: https://reviews.llvm.org/D119446

Added: 
    

Modified: 
    clang/include/clang/Driver/Options.td
    clang/test/Driver/cl-options.c

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index a64a6766e1645..d668118e58a0b 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -4454,7 +4454,9 @@ def mno_vzeroupper : Flag<["-"], "mno-vzeroupper">, Group<m_x86_Features_Group>;
 // These are legacy user-facing driver-level option spellings. They are always
 // aliases for options that are spelled using the more common Unix / GNU flag
 // style of double-dash and equals-joined flags.
-def target_legacy_spelling : Separate<["-"], "target">, Alias<target>;
+def target_legacy_spelling : Separate<["-"], "target">,
+                             Alias<target>,
+                             Flags<[CoreOption]>;
 
 // Special internal option to handle -Xlinker --no-demangle.
 def Z_Xlinker__no_demangle : Flag<["-"], "Z-Xlinker-no-demangle">,

diff  --git a/clang/test/Driver/cl-options.c b/clang/test/Driver/cl-options.c
index 50c2443c21899..f152c9f69819d 100644
--- a/clang/test/Driver/cl-options.c
+++ b/clang/test/Driver/cl-options.c
@@ -772,4 +772,9 @@
 // FAKEDIR: "-libpath:/foo{{/|\\\\}}Lib{{/|\\\\}}10.0.12345.0{{/|\\\\}}ucrt
 // FAKEDIR: "-libpath:/foo{{/|\\\\}}Lib{{/|\\\\}}10.0.12345.0{{/|\\\\}}um
 
+// Accept both the -target and --target= spellings.
+// RUN: %clang_cl --target=i686-pc-windows-msvc19.14.0 -### -- %s 2>&1 | FileCheck -check-prefix=TARGET %s
+// RUN: %clang_cl -target i686-pc-windows-msvc19.14.0  -### -- %s 2>&1 | FileCheck -check-prefix=TARGET %s
+// TARGET: "-triple" "i686-pc-windows-msvc19.14.0"
+
 void f(void) { }


        


More information about the cfe-commits mailing list