diff options
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/include/clang/AST/DeclTemplate.h | 7 | ||||
| -rw-r--r-- | clang/lib/AST/DeclTemplate.cpp | 8 |
2 files changed, 13 insertions, 2 deletions
diff --git a/clang/include/clang/AST/DeclTemplate.h b/clang/include/clang/AST/DeclTemplate.h index 774258711ca..b3277547e3d 100644 --- a/clang/include/clang/AST/DeclTemplate.h +++ b/clang/include/clang/AST/DeclTemplate.h @@ -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 { diff --git a/clang/lib/AST/DeclTemplate.cpp b/clang/lib/AST/DeclTemplate.cpp index a73deeab3a6..2005ff62f64 100644 --- a/clang/lib/AST/DeclTemplate.cpp +++ b/clang/lib/AST/DeclTemplate.cpp @@ -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()) |

