summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2018-09-14 15:18:30 +0000
committerHans Wennborg <hans@hanshq.net>2018-09-14 15:18:30 +0000
commitb51a70396e5d99bec354085f7cf96d127988f37b (patch)
tree9ae8be29cec2c34aa083f2373f849dfd42fbe4c4 /clang/lib
parentc0b474f67a33f7106e19ac21bbbe2fdd2ec1661b (diff)
downloadbcm5719-llvm-b51a70396e5d99bec354085f7cf96d127988f37b.tar.gz
bcm5719-llvm-b51a70396e5d99bec354085f7cf96d127988f37b.zip
[clang-cl] Fix PR38934: failing to dllexport class template member w/ explicit instantiation and PCH
The code in ASTContext::DeclMustBeEmitted was supposed to handle this, but didn't take into account that synthesized members such as operator= might not get marked as template specializations, because they're synthesized on the instantiation directly when handling the class-level dllexport attribute. llvm-svn: 342240
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/AST/ASTContext.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index b107e8bd2a3..3d0d1e666cd 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -9724,6 +9724,14 @@ bool ASTContext::DeclMustBeEmitted(const Decl *D) {
cast<FunctionDecl>(D)->getTemplateSpecializationKind() ==
TSK_ExplicitInstantiationDefinition;
+ // Implicit member function definitions, such as operator= might not be
+ // marked as template specializations, since they're not coming from a
+ // template but synthesized directly on the class.
+ IsExpInstDef |=
+ isa<CXXMethodDecl>(D) &&
+ cast<CXXMethodDecl>(D)->getParent()->getTemplateSpecializationKind() ==
+ TSK_ExplicitInstantiationDefinition;
+
if (getExternalSource()->DeclIsFromPCHWithObjectFile(D) && !IsExpInstDef)
return false;
}
OpenPOWER on IntegriCloud