Introduce RedeclarableTemplateDecl::SpecEntryTraits

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

llvm-svn: 109868
This commit is contained in:
Peter Collingbourne 2010-07-30 17:08:56 +00:00
parent 3df5a08b99
commit e3de2ebe75
1 changed files with 18 additions and 0 deletions

View 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> {