Skip to content

Commit ae610a2

Browse files
committed
Merging r312748:
------------------------------------------------------------------------ r312748 | jroelofs | 2017-09-07 15:01:25 -0700 (Thu, 07 Sep 2017) | 10 lines Fix validation of the -mthread-model flag in the Clang driver The ToolChain class validates the -mthread-model flag in the constructor which doesn't work correctly since the thread model methods are virtual methods. The check is moved into Clang::ConstructJob() when constructing the internal command line. https://reviews.llvm.org/D37496 Patch by: Ian Tessier! ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_50@318346 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 07710e9 commit ae610a2

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

lib/Driver/ToolChain.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,6 @@ ToolChain::ToolChain(const Driver &D, const llvm::Triple &T,
7474
: D(D), Triple(T), Args(Args), CachedRTTIArg(GetRTTIArgument(Args)),
7575
CachedRTTIMode(CalculateRTTIMode(Args, Triple, CachedRTTIArg)),
7676
EffectiveTriple() {
77-
if (Arg *A = Args.getLastArg(options::OPT_mthread_model))
78-
if (!isThreadModelSupported(A->getValue()))
79-
D.Diag(diag::err_drv_invalid_thread_model_for_target)
80-
<< A->getValue() << A->getAsString(Args);
81-
8277
std::string CandidateLibPath = getArchSpecificLibPath();
8378
if (getVFS().exists(CandidateLibPath))
8479
getFilePaths().push_back(CandidateLibPath);

lib/Driver/ToolChains/Clang.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2227,8 +2227,12 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
22272227
}
22282228

22292229
CmdArgs.push_back("-mthread-model");
2230-
if (Arg *A = Args.getLastArg(options::OPT_mthread_model))
2230+
if (Arg *A = Args.getLastArg(options::OPT_mthread_model)) {
2231+
if (!getToolChain().isThreadModelSupported(A->getValue()))
2232+
D.Diag(diag::err_drv_invalid_thread_model_for_target)
2233+
<< A->getValue() << A->getAsString(Args);
22312234
CmdArgs.push_back(A->getValue());
2235+
}
22322236
else
22332237
CmdArgs.push_back(Args.MakeArgString(getToolChain().getThreadModel()));
22342238

0 commit comments

Comments
 (0)