summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Stellard <tstellar@redhat.com>2017-11-15 22:41:48 +0000
committerTom Stellard <tstellar@redhat.com>2017-11-15 22:41:48 +0000
commitae610a215a867aadf97fc8cf9a61f9ffe4901476 (patch)
tree00ea09431f7e7fde115ebf627b904f3ee3aecc4c
parent07710e95e6ae30016fb3f5239cc661e6c5594e75 (diff)
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
-rw-r--r--lib/Driver/ToolChain.cpp5
-rw-r--r--lib/Driver/ToolChains/Clang.cpp6
2 files changed, 5 insertions, 6 deletions
diff --git a/lib/Driver/ToolChain.cpp b/lib/Driver/ToolChain.cpp
index 9a858df8ab..12afb18c23 100644
--- a/lib/Driver/ToolChain.cpp
+++ b/lib/Driver/ToolChain.cpp
@@ -74,11 +74,6 @@ ToolChain::ToolChain(const Driver &D, const llvm::Triple &T,
: D(D), Triple(T), Args(Args), CachedRTTIArg(GetRTTIArgument(Args)),
CachedRTTIMode(CalculateRTTIMode(Args, Triple, CachedRTTIArg)),
EffectiveTriple() {
- if (Arg *A = Args.getLastArg(options::OPT_mthread_model))
- if (!isThreadModelSupported(A->getValue()))
- D.Diag(diag::err_drv_invalid_thread_model_for_target)
- << A->getValue() << A->getAsString(Args);
-
std::string CandidateLibPath = getArchSpecificLibPath();
if (getVFS().exists(CandidateLibPath))
getFilePaths().push_back(CandidateLibPath);
diff --git a/lib/Driver/ToolChains/Clang.cpp b/lib/Driver/ToolChains/Clang.cpp
index 6a6b90f868..497f0b4932 100644
--- a/lib/Driver/ToolChains/Clang.cpp
+++ b/lib/Driver/ToolChains/Clang.cpp
@@ -2227,8 +2227,12 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
}
CmdArgs.push_back("-mthread-model");
- if (Arg *A = Args.getLastArg(options::OPT_mthread_model))
+ if (Arg *A = Args.getLastArg(options::OPT_mthread_model)) {
+ if (!getToolChain().isThreadModelSupported(A->getValue()))
+ D.Diag(diag::err_drv_invalid_thread_model_for_target)
+ << A->getValue() << A->getAsString(Args);
CmdArgs.push_back(A->getValue());
+ }
else
CmdArgs.push_back(Args.MakeArgString(getToolChain().getThreadModel()));