Devirtualize RedeclarableTemplateDecl::newCommon().

llvm-svn: 125750
This commit is contained in:
Douglas Gregor 2011-02-17 17:10:20 +00:00
parent c6196aa481
commit 0215459c37
2 changed files with 13 additions and 2 deletions

View File

@ -561,7 +561,7 @@ protected:
/// for the common pointer.
CommonBase *getCommonPtr();
virtual CommonBase *newCommon(ASTContext &C) = 0;
CommonBase *newCommon(ASTContext &C);
// Construct a template decl with name, parameters, and templated element.
RedeclarableTemplateDecl(Kind DK, DeclContext *DC, SourceLocation L,
@ -773,7 +773,8 @@ protected:
}
friend class FunctionDecl;
friend class RedeclarableTemplateDecl;
/// \brief Retrieve the set of function template specializations of this
/// function template.
llvm::FoldingSet<FunctionTemplateSpecializationInfo> &getSpecializations() {
@ -1731,6 +1732,8 @@ protected:
return static_cast<Common *>(RedeclarableTemplateDecl::getCommonPtr());
}
friend class RedeclarableTemplateDecl;
public:
/// Get the underlying class declarations of the template.
CXXRecordDecl *getTemplatedDecl() const {

View File

@ -112,6 +112,14 @@ RedeclarableTemplateDecl::CommonBase *RedeclarableTemplateDecl::getCommonPtr() {
}
RedeclarableTemplateDecl::CommonBase *
RedeclarableTemplateDecl::newCommon(ASTContext &C) {
if (FunctionTemplateDecl *FunTmpl = dyn_cast<FunctionTemplateDecl>(this))
return FunTmpl->newCommon(C);
return cast<ClassTemplateDecl>(this)->newCommon(C);
}
RedeclarableTemplateDecl *RedeclarableTemplateDecl::getCanonicalDeclImpl() {
RedeclarableTemplateDecl *Tmpl = this;
while (Tmpl->getPreviousDeclaration())