summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/DeclTemplate.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-06-19 19:29:09 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-06-19 19:29:09 +0000
commit95c04caf9247d2d459003a649d5e434e820f3350 (patch)
tree24d8776dd2f81349fa4ecf39de7fb63f753cb66f /clang/lib/AST/DeclTemplate.cpp
parent106caf92cdfe96aa4a113cb3075c283841346af3 (diff)
downloadbcm5719-llvm-95c04caf9247d2d459003a649d5e434e820f3350.tar.gz
bcm5719-llvm-95c04caf9247d2d459003a649d5e434e820f3350.zip
Initial support for reading templates from PCH.
llvm-svn: 106392
Diffstat (limited to 'clang/lib/AST/DeclTemplate.cpp')
-rw-r--r--clang/lib/AST/DeclTemplate.cpp28
1 files changed, 18 insertions, 10 deletions
diff --git a/clang/lib/AST/DeclTemplate.cpp b/clang/lib/AST/DeclTemplate.cpp
index 85b79600754..1fcf92309b7 100644
--- a/clang/lib/AST/DeclTemplate.cpp
+++ b/clang/lib/AST/DeclTemplate.cpp
@@ -155,23 +155,31 @@ ClassTemplateDecl *ClassTemplateDecl::getCanonicalDecl() {
return Template;
}
-ClassTemplateDecl *ClassTemplateDecl::Create(ASTContext &C,
- DeclContext *DC,
- SourceLocation L,
- DeclarationName Name,
- TemplateParameterList *Params,
- NamedDecl *Decl,
- ClassTemplateDecl *PrevDecl) {
- Common *CommonPtr;
+void ClassTemplateDecl::initPreviousDeclaration(ASTContext &C,
+ ClassTemplateDecl *PrevDecl) {
+ assert(PreviousDeclaration == 0 && "PreviousDeclaration already set!");
+ assert(CommonPtr == 0 && "initPreviousDeclaration already called!");
+
+ PreviousDeclaration = PrevDecl;
+
if (PrevDecl)
CommonPtr = PrevDecl->CommonPtr;
else {
CommonPtr = new (C) Common;
C.AddDeallocation(DeallocateCommon, CommonPtr);
}
+}
- return new (C) ClassTemplateDecl(DC, L, Name, Params, Decl, PrevDecl,
- CommonPtr);
+ClassTemplateDecl *ClassTemplateDecl::Create(ASTContext &C,
+ DeclContext *DC,
+ SourceLocation L,
+ DeclarationName Name,
+ TemplateParameterList *Params,
+ NamedDecl *Decl,
+ ClassTemplateDecl *PrevDecl) {
+ ClassTemplateDecl *New = new (C) ClassTemplateDecl(DC, L, Name, Params, Decl);
+ New->initPreviousDeclaration(C, PrevDecl);
+ return New;
}
ClassTemplateDecl::~ClassTemplateDecl() {
OpenPOWER on IntegriCloud