Skip to content

Commit 814efff

Browse files
MaxEW707tmsri
authored andcommitted
[Clang] [Driver] Ensure -fms-volatile is set for x86 for *-windows-msvc triple on non cl driver modes (llvm#107509)
Similar reasoning as this PR: llvm#107177 `-fms-volatile` should be set by default for x86 targets as long as the triple is `*-windows-msvc`. The driver mode shouldn't dictate the triple when targeting msvc compatibility.
1 parent 37e8c15 commit 814efff

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6004,7 +6004,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
60046004
}
60056005

60066006
if (Args.hasFlag(options::OPT_fms_volatile, options::OPT_fno_ms_volatile,
6007-
Triple.isX86() && D.IsCLMode()))
6007+
Triple.isX86() && IsWindowsMSVC))
60086008
CmdArgs.push_back("-fms-volatile");
60096009

60106010
// Non-PIC code defaults to -fdirect-access-external-data while PIC code

clang/test/Driver/clang_f_opts.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,10 @@
623623
// RUN: %clang -### --target=aarch64-windows-msvc %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MS-VOLATILE %s
624624
// RUN: %clang -### --target=aarch64-windows-msvc -fms-volatile %s 2>&1 | FileCheck -check-prefix=CHECK-MS-VOLATILE %s
625625
// RUN: %clang -### --target=aarch64-windows-msvc -fno-ms-volatile %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MS-VOLATILE %s
626+
// RUN: %clang -### --target=x86_64-windows-msvc %s 2>&1 | FileCheck -check-prefix=CHECK-MS-VOLATILE %s
627+
// RUN: %clang -### --target=x86_64-windows-msvc -fno-ms-volatile %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MS-VOLATILE %s
628+
// RUN: %clang -### --target=i686-windows-msvc %s 2>&1 | FileCheck -check-prefix=CHECK-MS-VOLATILE %s
629+
// RUN: %clang -### --target=i686-windows-msvc -fno-ms-volatile %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MS-VOLATILE %s
626630
// CHECK-MS-VOLATILE: -fms-volatile
627631
// CHECK-NO-MS-VOLATILE-NOT: -fms-volatile
628632

0 commit comments

Comments
 (0)