[PATCH] D37496: Fix validation of the -mthread-model flag in the Clang driver
Ian Tessier via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 5 16:32:22 PDT 2017
itessier created this revision.
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
Files:
lib/Driver/ToolChain.cpp
lib/Driver/ToolChains/Clang.cpp
Index: lib/Driver/ToolChains/Clang.cpp
===================================================================
--- lib/Driver/ToolChains/Clang.cpp
+++ lib/Driver/ToolChains/Clang.cpp
@@ -3254,8 +3254,12 @@
}
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()));
Index: lib/Driver/ToolChain.cpp
===================================================================
--- lib/Driver/ToolChain.cpp
+++ lib/Driver/ToolChain.cpp
@@ -74,11 +74,6 @@
: 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);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37496.113932.patch
Type: text/x-patch
Size: 1408 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170905/8d9633bb/attachment.bin>
More information about the cfe-commits
mailing list