]> granicus.if.org Git - clang/commitdiff
Introduce getMostRecentDeclaration() and getFirstDeclaration() for RedeclarableTempla...
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Tue, 3 Aug 2010 17:30:01 +0000 (17:30 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Tue, 3 Aug 2010 17:30:01 +0000 (17:30 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110124 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/DeclTemplate.h

index 246a06f9633c85630829cfa0a0a46332e5b28775..ff5f9f1314c833709740735930dbb21b8c96544f 100644 (file)
@@ -613,6 +613,32 @@ public:
       const_cast<RedeclarableTemplateDecl*>(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<RedeclarableTemplateDecl*>(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<RedeclarableTemplateDecl*>(this)->getMostRecentDeclaration();
+  }
+
   /// \brief Determines whether this template was a specialization of a 
   /// member template.
   ///