mirror of https://github.com/microsoft/clang.git
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:
parent
2123f44cb9
commit
150955a753
|
@ -10978,6 +10978,14 @@ std::unique_ptr<Command> visualstudio::Compiler::GetCommand(
|
||||||
options::OPT__SLASH_MT, options::OPT__SLASH_MTd))
|
options::OPT__SLASH_MT, options::OPT__SLASH_MTd))
|
||||||
A->render(Args, CmdArgs);
|
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
|
// Pass through all unknown arguments so that the fallback command can see
|
||||||
// them too.
|
// them too.
|
||||||
Args.AddAllArgs(CmdArgs, options::OPT_UNKNOWN);
|
Args.AddAllArgs(CmdArgs, options::OPT_UNKNOWN);
|
||||||
|
|
|
@ -46,6 +46,12 @@
|
||||||
// GS: cl.exe
|
// GS: cl.exe
|
||||||
// GS: "/GS-"
|
// 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
|
// RUN: %clang_cl /fallback /Od -### -- %s 2>&1 | FileCheck -check-prefix=O0 %s
|
||||||
// O0: cl.exe
|
// O0: cl.exe
|
||||||
// O0: "/Od"
|
// O0: "/Od"
|
||||||
|
|
Loading…
Reference in New Issue