]> granicus.if.org Git - clang/commitdiff
Implement RedeclarableTemplateDecl::getNextRedeclaration
authorPeter Collingbourne <peter@pcc.me.uk>
Thu, 29 Jul 2010 16:12:09 +0000 (16:12 +0000)
committerPeter Collingbourne <peter@pcc.me.uk>
Thu, 29 Jul 2010 16:12:09 +0000 (16:12 +0000)
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
lib/AST/DeclTemplate.cpp

index 8d3cfad8179dc0834a40d4013e865e6d6903f457..b26c569d5d00aa3610ecc81ee74d96ed12c64731 100644 (file)
@@ -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; }
index 0ca2837627f1e9dc043c6cff35e717ba292ded10..25df086e73cfaa1f769c35c2b904f0286515cd69 100644 (file)
@@ -119,6 +119,13 @@ void RedeclarableTemplateDecl::setPreviousDeclarationImpl(
   }
 }
 
+RedeclarableTemplateDecl *RedeclarableTemplateDecl::getNextRedeclaration() {
+  if (CommonOrPrev.is<RedeclarableTemplateDecl*>())
+    return CommonOrPrev.get<RedeclarableTemplateDecl*>();
+  CommonBase *Common = CommonOrPrev.get<CommonBase*>();
+  return Common ? Common->Latest : this;
+}
+
 //===----------------------------------------------------------------------===//
 // FunctionTemplateDecl Implementation
 //===----------------------------------------------------------------------===//