[cfe-commits] r109868 - /cfe/trunk/include/clang/AST/DeclTemplate.h

Peter Collingbourne peter at pcc.me.uk
Fri Jul 30 10:08:56 PDT 2010


Author: pcc
Date: Fri Jul 30 12:08:56 2010
New Revision: 109868

URL: http://llvm.org/viewvc/llvm-project?rev=109868&view=rev
Log:
Introduce RedeclarableTemplateDecl::SpecEntryTraits

SpecEntryTraits describes how to obtain the most recent declaration
of a specialisation from an entry in a specialisation FoldingSet.

Modified:
    cfe/trunk/include/clang/AST/DeclTemplate.h

Modified: cfe/trunk/include/clang/AST/DeclTemplate.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclTemplate.h?rev=109868&r1=109867&r2=109868&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclTemplate.h (original)
+++ cfe/trunk/include/clang/AST/DeclTemplate.h Fri Jul 30 12:08:56 2010
@@ -504,6 +504,14 @@
   }
 
 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 @@
   }
 };
 
+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> {





More information about the cfe-commits mailing list