diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-10-08 07:24:58 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-10-08 07:24:58 +0000 |
commit | 251b4ff2578e26959a4c036140ccd61c5e9292f2 (patch) | |
tree | cacc1f2c9bfb3174e9914422eef9de64890b06cd /lib/AST/Decl.cpp | |
parent | e9374d5e2c0915bd883dfa988db2451b844390d8 (diff) |
For instantiations of static data members of class templates, keep
track of the kind of specialization or instantiation. Also, check the
scope of the specialization and ensure that a specialization
declaration without an initializer is not a definition.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83533 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Decl.cpp')
-rw-r--r-- | lib/AST/Decl.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index a5c9fa4bac..5584e4c3da 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -371,7 +371,26 @@ SourceRange VarDecl::getSourceRange() const { } VarDecl *VarDecl::getInstantiatedFromStaticDataMember() { - return getASTContext().getInstantiatedFromStaticDataMember(this); + if (MemberSpecializationInfo *MSI + = getASTContext().getInstantiatedFromStaticDataMember(this)) + return cast<VarDecl>(MSI->getInstantiatedFrom()); + + return 0; +} + +TemplateSpecializationKind VarDecl::getTemplateSpecializationKind() { + if (MemberSpecializationInfo *MSI + = getASTContext().getInstantiatedFromStaticDataMember(this)) + return MSI->getTemplateSpecializationKind(); + + return TSK_Undeclared; +} + +void VarDecl::setTemplateSpecializationKind(TemplateSpecializationKind TSK) { + MemberSpecializationInfo *MSI + = getASTContext().getInstantiatedFromStaticDataMember(this); + assert(MSI && "Not an instantiated static data member?"); + MSI->setTemplateSpecializationKind(TSK); } bool VarDecl::isTentativeDefinition(ASTContext &Context) const { |