Skip to content

Commit 8baa076

Browse files
committed
[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
1 parent 02e0d50 commit 8baa076

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

clang/include/clang/Driver/Options.td

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4454,7 +4454,9 @@ def mno_vzeroupper : Flag<["-"], "mno-vzeroupper">, Group<m_x86_Features_Group>;
44544454
// These are legacy user-facing driver-level option spellings. They are always
44554455
// aliases for options that are spelled using the more common Unix / GNU flag
44564456
// style of double-dash and equals-joined flags.
4457-
def target_legacy_spelling : Separate<["-"], "target">, Alias<target>;
4457+
def target_legacy_spelling : Separate<["-"], "target">,
4458+
Alias<target>,
4459+
Flags<[CoreOption]>;
44584460

44594461
// Special internal option to handle -Xlinker --no-demangle.
44604462
def Z_Xlinker__no_demangle : Flag<["-"], "Z-Xlinker-no-demangle">,

clang/test/Driver/cl-options.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -772,4 +772,9 @@
772772
// FAKEDIR: "-libpath:/foo{{/|\\\\}}Lib{{/|\\\\}}10.0.12345.0{{/|\\\\}}ucrt
773773
// FAKEDIR: "-libpath:/foo{{/|\\\\}}Lib{{/|\\\\}}10.0.12345.0{{/|\\\\}}um
774774

775+
// Accept both the -target and --target= spellings.
776+
// RUN: %clang_cl --target=i686-pc-windows-msvc19.14.0 -### -- %s 2>&1 | FileCheck -check-prefix=TARGET %s
777+
// RUN: %clang_cl -target i686-pc-windows-msvc19.14.0 -### -- %s 2>&1 | FileCheck -check-prefix=TARGET %s
778+
// TARGET: "-triple" "i686-pc-windows-msvc19.14.0"
779+
775780
void f(void) { }

0 commit comments

Comments
 (0)