From: Peter Collingbourne Date: Fri, 30 Jul 2010 17:08:56 +0000 (+0000) Subject: Introduce RedeclarableTemplateDecl::SpecEntryTraits X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=44dd0b440efdb37ff4c6e49f243faa3b0580b120;p=clang Introduce RedeclarableTemplateDecl::SpecEntryTraits 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 --- diff --git a/include/clang/AST/DeclTemplate.h b/include/clang/AST/DeclTemplate.h index b26c569d5d..341c802f50 100644 --- a/include/clang/AST/DeclTemplate.h +++ b/include/clang/AST/DeclTemplate.h @@ -504,6 +504,14 @@ class RedeclarableTemplateDecl : public TemplateDecl { } protected: + template 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 { + typedef FunctionDecl DeclType; + + static DeclType * + getMostRecentDeclaration(FunctionTemplateSpecializationInfo *I) { + return I->Function->getMostRecentDeclaration(); + } +}; + /// Declaration of a template function. class FunctionTemplateDecl : public RedeclarableTemplateDecl, public RedeclarableTemplate {