From f88718ea0ca0d64b7fd31d109f1d9ec769a9c45f Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Thu, 29 Jul 2010 16:12:09 +0000 Subject: [PATCH] Implement RedeclarableTemplateDecl::getNextRedeclaration This patch uses the newly added Latest field of CommonBase to provide a getNextRedeclaration() implementation for RedeclarableTemplateDecl. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109756 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/AST/DeclTemplate.h | 2 ++ lib/AST/DeclTemplate.cpp | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/include/clang/AST/DeclTemplate.h b/include/clang/AST/DeclTemplate.h index 8d3cfad817..b26c569d5d 100644 --- a/include/clang/AST/DeclTemplate.h +++ b/include/clang/AST/DeclTemplate.h @@ -592,6 +592,8 @@ public: return getInstantiatedFromMemberTemplateImpl(); } + virtual RedeclarableTemplateDecl *getNextRedeclaration(); + // Implement isa/cast/dyncast/etc. static bool classof(const Decl *D) { return classofKind(D->getKind()); } static bool classof(const RedeclarableTemplateDecl *D) { return true; } diff --git a/lib/AST/DeclTemplate.cpp b/lib/AST/DeclTemplate.cpp index 0ca2837627..25df086e73 100644 --- a/lib/AST/DeclTemplate.cpp +++ b/lib/AST/DeclTemplate.cpp @@ -119,6 +119,13 @@ void RedeclarableTemplateDecl::setPreviousDeclarationImpl( } } +RedeclarableTemplateDecl *RedeclarableTemplateDecl::getNextRedeclaration() { + if (CommonOrPrev.is()) + return CommonOrPrev.get(); + CommonBase *Common = CommonOrPrev.get(); + return Common ? Common->Latest : this; +} + //===----------------------------------------------------------------------===// // FunctionTemplateDecl Implementation //===----------------------------------------------------------------------===// -- 2.40.0