diff options
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/CodeGen/CGVtable.cpp | 12 | ||||
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 13 | ||||
-rw-r--r-- | clang/lib/Sema/SemaTemplate.cpp | 8 |
3 files changed, 10 insertions, 23 deletions
diff --git a/clang/lib/CodeGen/CGVtable.cpp b/clang/lib/CodeGen/CGVtable.cpp index cedefba1e4e..9204e4e565c 100644 --- a/clang/lib/CodeGen/CGVtable.cpp +++ b/clang/lib/CodeGen/CGVtable.cpp @@ -3805,17 +3805,7 @@ void CodeGenVTables::EmitVTableRelatedData(GlobalDecl GD) { return; TemplateSpecializationKind kind = RD->getTemplateSpecializationKind(); - - - // The reason we have TSK_ExplicitInstantiationDeclaration in here (but not - // in Sema::MaybeMarkVirtualMembersReferenced) is for the case - // template<> void stdio_sync_filebuf<wchar_t>::xsgetn() { - // } - // extern template class stdio_sync_filebuf<wchar_t>; - // Since we are called after the extern declaration is seen. - - if (kind == TSK_ImplicitInstantiation || - kind == TSK_ExplicitInstantiationDeclaration) + if (kind == TSK_ImplicitInstantiation) CGM.DeferredVtables.push_back(RD); else GenerateClassData(CGM.getVtableLinkage(RD), RD); diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 69ce49cbb18..1606710bc5c 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -310,17 +310,8 @@ GetLinkageForFunction(ASTContext &Context, const FunctionDecl *FD, // instantiated when used so that the body can be considered for // inlining, but that no out-of-line copy of the inline function would be // generated in the translation unit. -- end note ] - - // We check the specialization kind of the class for implicit methods. - // They have a TSK_Undeclared specialization kind. - TemplateSpecializationKind TSK; - const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(FD); - if (MD && MD->isImplicit()) - TSK = MD->getParent()->getTemplateSpecializationKind(); - else - TSK = FD->getTemplateSpecializationKind(); - - if (TSK == TSK_ExplicitInstantiationDeclaration) + if (FD->getTemplateSpecializationKind() + == TSK_ExplicitInstantiationDeclaration) return CodeGenModule::GVA_C99Inline; return CodeGenModule::GVA_CXXInline; diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index d7b613e02b2..abe9363352e 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -4389,7 +4389,13 @@ Sema::ActOnExplicitInstantiation(Scope *S, Def = cast_or_null<ClassTemplateSpecializationDecl>( Specialization->getDefinition()); if (Def) { - Def->setTemplateSpecializationKind(TSK); + TemplateSpecializationKind Old_TSK = Def->getTemplateSpecializationKind(); + + // Fix a TSK_ExplicitInstantiationDeclaration followed by a + // TSK_ExplicitInstantiationDefinition + if (Old_TSK == TSK_ExplicitInstantiationDeclaration && + TSK == TSK_ExplicitInstantiationDefinition) + Def->setTemplateSpecializationKind(TSK); InstantiateClassTemplateSpecializationMembers(TemplateNameLoc, Def, TSK); } |