diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2010-07-29 16:12:01 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2010-07-29 16:12:01 +0000 |
commit | 8a798a7f7d88dc9865fad7da648e5cef8580c65a (patch) | |
tree | 992a28e0fb6869eaa3124a98de6fece69a2305a0 /lib/AST/DeclTemplate.cpp | |
parent | 9eabebafc165a67812eacc184806e7bf34c5f0a5 (diff) |
Store latest redeclaration for each redeclarable template declaration
This patch adds a Latest field to RedeclarableTemplateDecl's CommonBase
class which is used to store the latest redeclaration.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109755 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/DeclTemplate.cpp')
-rw-r--r-- | lib/AST/DeclTemplate.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/AST/DeclTemplate.cpp b/lib/AST/DeclTemplate.cpp index de17568942..0ca2837627 100644 --- a/lib/AST/DeclTemplate.cpp +++ b/lib/AST/DeclTemplate.cpp @@ -94,6 +94,7 @@ RedeclarableTemplateDecl::CommonBase *RedeclarableTemplateDecl::getCommonPtr() { if (First->CommonOrPrev.isNull()) { CommonBase *CommonPtr = First->newCommon(); First->CommonOrPrev = CommonPtr; + CommonPtr->Latest = First; } return First->CommonOrPrev.get<CommonBase*>(); } @@ -106,6 +107,18 @@ RedeclarableTemplateDecl *RedeclarableTemplateDecl::getCanonicalDeclImpl() { return Tmpl; } +void RedeclarableTemplateDecl::setPreviousDeclarationImpl( + RedeclarableTemplateDecl *Prev) { + if (Prev) { + CommonBase *Common = Prev->getCommonPtr(); + Prev = Common->Latest; + Common->Latest = this; + CommonOrPrev = Prev; + } else { + assert(CommonOrPrev.is<CommonBase*>() && "Cannot reset TemplateDecl Prev"); + } +} + //===----------------------------------------------------------------------===// // FunctionTemplateDecl Implementation //===----------------------------------------------------------------------===// |