clang-cl: Pass /Zc:threadSafeInit through to MSVC with /fallback (PR30948)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@286324 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Hans Wennborg 2016-11-09 00:56:42 +00:00
parent 2123f44cb9
commit 150955a753
2 changed files with 14 additions and 0 deletions

View File

@ -10978,6 +10978,14 @@ std::unique_ptr<Command> visualstudio::Compiler::GetCommand(
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);

View File

@ -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"