r286324 - clang-cl: Pass /Zc:threadSafeInit through to MSVC with /fallback (PR30948)
Hans Wennborg via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 8 16:56:42 PST 2016
Author: hans
Date: Tue Nov 8 18:56:42 2016
New Revision: 286324
URL: http://llvm.org/viewvc/llvm-project?rev=286324&view=rev
Log:
clang-cl: Pass /Zc:threadSafeInit through to MSVC with /fallback (PR30948)
Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/cl-fallback.c
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=286324&r1=286323&r2=286324&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Tue Nov 8 18:56:42 2016
@@ -10978,6 +10978,14 @@ std::unique_ptr<Command> visualstudio::C
options::OPT__SLASH_MT, options::OPT__SLASH_MTd))
A->render(Args, CmdArgs);
+ // Use MSVC's default threadsafe statics behaviour unless there was a flag.
+ if (Arg *A = Args.getLastArg(options::OPT_fthreadsafe_statics,
+ options::OPT_fno_threadsafe_statics)) {
+ CmdArgs.push_back(A->getOption().getID() == options::OPT_fthreadsafe_statics
+ ? "/Zc:threadSafeInit"
+ : "/Zc:threadSafeInit-");
+ }
+
// Pass through all unknown arguments so that the fallback command can see
// them too.
Args.AddAllArgs(CmdArgs, options::OPT_UNKNOWN);
Modified: cfe/trunk/test/Driver/cl-fallback.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-fallback.c?rev=286324&r1=286323&r2=286324&view=diff
==============================================================================
--- cfe/trunk/test/Driver/cl-fallback.c (original)
+++ cfe/trunk/test/Driver/cl-fallback.c Tue Nov 8 18:56:42 2016
@@ -46,6 +46,12 @@
// GS: cl.exe
// GS: "/GS-"
+// RUN: %clang_cl /fallback /Zc:threadSafeInit -### -- %s 2>&1 | FileCheck -check-prefix=ThreadSafe %s
+// ThreadSafe: /Zc:threadSafeInit
+
+// RUN: %clang_cl /fallback /Zc:threadSafeInit- -### -- %s 2>&1 | FileCheck -check-prefix=NonThreadSafe %s
+// NonThreadSafe: /Zc:threadSafeInit-
+
// RUN: %clang_cl /fallback /Od -### -- %s 2>&1 | FileCheck -check-prefix=O0 %s
// O0: cl.exe
// O0: "/Od"
More information about the cfe-commits
mailing list