]> granicus.if.org Git - clang/commitdiff
Introduce RedeclarableTemplateDecl::SpecEntryTraits
authorPeter Collingbourne <peter@pcc.me.uk>
Fri, 30 Jul 2010 17:08:56 +0000 (17:08 +0000)
committerPeter Collingbourne <peter@pcc.me.uk>
Fri, 30 Jul 2010 17:08:56 +0000 (17:08 +0000)
SpecEntryTraits describes how to obtain the most recent declaration
of a specialisation from an entry in a specialisation FoldingSet.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109868 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/DeclTemplate.h

index b26c569d5d00aa3610ecc81ee74d96ed12c64731..341c802f507d4cae00d853e8cd5cd1c2637ea660 100644 (file)
@@ -504,6 +504,14 @@ class RedeclarableTemplateDecl : public TemplateDecl {
   }
 
 protected:
+  template <typename EntryType> struct SpecEntryTraits {
+    typedef EntryType DeclType;
+
+    static DeclType *getMostRecentDeclaration(EntryType *D) {
+      return D->getMostRecentDeclaration();
+    }
+  };
+
   struct CommonBase {
     CommonBase() : InstantiatedFromMember(0, false) { }
 
@@ -677,6 +685,16 @@ public:
   }
 };
 
+template <> struct RedeclarableTemplateDecl::
+SpecEntryTraits<FunctionTemplateSpecializationInfo> {
+  typedef FunctionDecl DeclType;
+
+  static DeclType *
+  getMostRecentDeclaration(FunctionTemplateSpecializationInfo *I) {
+    return I->Function->getMostRecentDeclaration();
+  }
+};
+
 /// Declaration of a template function.
 class FunctionTemplateDecl : public RedeclarableTemplateDecl,
                              public RedeclarableTemplate<FunctionTemplateDecl> {