diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2012-03-05 10:54:55 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2012-03-05 10:54:55 +0000 |
commit | 189fa748ec9e05820f7c5df8ff00aa3c7bc0546c (patch) | |
tree | 20583052017fe002b904ee90abb1f5cde9e6a733 /clang/lib/Sema/SemaTemplateInstantiateDecl.cpp | |
parent | 08a47fd708680fc67f8c1c80f64379b35d6f472c (diff) | |
download | bcm5719-llvm-189fa748ec9e05820f7c5df8ff00aa3c7bc0546c.tar.gz bcm5719-llvm-189fa748ec9e05820f7c5df8ff00aa3c7bc0546c.zip |
Fix a small difference in sema and codegen views of what needs to be output.
In the included testcase, soma thinks that we already have a definition after we
see the out of line decl. Codegen puts it in a deferred list, to be output if
a use is seen. This would break when we saw an explicit template instantiation
definition, since codegen would not be notified.
This patch adds a method to the consumer interface so that soma can notify
codegen that this decl is now required.
llvm-svn: 152024
Diffstat (limited to 'clang/lib/Sema/SemaTemplateInstantiateDecl.cpp')
-rw-r--r-- | clang/lib/Sema/SemaTemplateInstantiateDecl.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp index d491dfc51ed..4633db737ac 100644 --- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -2596,21 +2596,25 @@ void Sema::InstantiateStaticDataMemberDefinition( return; } + TemplateSpecializationKind TSK = Var->getTemplateSpecializationKind(); + // Never instantiate an explicit specialization. - if (Var->getTemplateSpecializationKind() == TSK_ExplicitSpecialization) + if (TSK == TSK_ExplicitSpecialization) return; // C++0x [temp.explicit]p9: // Except for inline functions, other explicit instantiation declarations // have the effect of suppressing the implicit instantiation of the entity // to which they refer. - if (Var->getTemplateSpecializationKind() - == TSK_ExplicitInstantiationDeclaration) + if (TSK == TSK_ExplicitInstantiationDeclaration) return; // If we already have a definition, we're done. - if (Var->getDefinition()) + if (Var->getDefinition()) { + if (TSK == TSK_ExplicitInstantiationDefinition) + Consumer.MarkVarRequired(Var); return; + } InstantiatingTemplate Inst(*this, PointOfInstantiation, Var); if (Inst) |