From a6430cfe4830787f366e6b46744d8327d659968c Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Tue, 3 Aug 2010 17:30:01 +0000 Subject: [PATCH] Introduce getMostRecentDeclaration() and getFirstDeclaration() for RedeclarableTemplateDecl. llvm-svn: 110124 --- clang/include/clang/AST/DeclTemplate.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/clang/include/clang/AST/DeclTemplate.h b/clang/include/clang/AST/DeclTemplate.h index 246a06f9633c..ff5f9f1314c8 100644 --- a/clang/include/clang/AST/DeclTemplate.h +++ b/clang/include/clang/AST/DeclTemplate.h @@ -613,6 +613,32 @@ public: const_cast(this)->getPreviousDeclaration(); } + /// \brief Retrieve the first declaration of this template, or itself + /// if this the first one. + RedeclarableTemplateDecl *getFirstDeclaration() { + return getCanonicalDecl(); + } + + /// \brief Retrieve the first declaration of this template, or itself + /// if this the first one. + const RedeclarableTemplateDecl *getFirstDeclaration() const { + return + const_cast(this)->getFirstDeclaration(); + } + + /// \brief Retrieve the most recent declaration of this template, or itself + /// if this the most recent one. + RedeclarableTemplateDecl *getMostRecentDeclaration() { + return getCommonPtr()->Latest; + } + + /// \brief Retrieve the most recent declaration of this template, or itself + /// if this the most recent one. + const RedeclarableTemplateDecl *getMostRecentDeclaration() const { + return + const_cast(this)->getMostRecentDeclaration(); + } + /// \brief Determines whether this template was a specialization of a /// member template. ///