diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2010-09-08 19:31:22 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2010-09-08 19:31:22 +0000 |
commit | f4bc0d87ee733daf490defee742a07feef295234 (patch) | |
tree | 4180d712815b49cea7da00f2e6c5a70dee5b14b1 /clang/lib/AST/DeclTemplate.cpp | |
parent | d79bb127ddd8fd988e3bdfb9fc20d58f663779b6 (diff) | |
download | bcm5719-llvm-f4bc0d87ee733daf490defee742a07feef295234.tar.gz bcm5719-llvm-f4bc0d87ee733daf490defee742a07feef295234.zip |
Fix C++ PCH issues.
PCH got a severe beating by the boost-using test case reported here: http://llvm.org/PR8099
Fix issues like:
-When PCH reading, make sure Decl's getASTContext() doesn't get called since a Decl in the parent hierarchy may be initializing.
-In ASTDeclReader::VisitFunctionDecl VisitRedeclarable should be called before using FunctionDecl's isCanonicalDecl()
-In ASTDeclReader::VisitRedeclarableTemplateDecl CommonOrPrev must be initialized before anything else.
llvm-svn: 113391
Diffstat (limited to 'clang/lib/AST/DeclTemplate.cpp')
-rw-r--r-- | clang/lib/AST/DeclTemplate.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/clang/lib/AST/DeclTemplate.cpp b/clang/lib/AST/DeclTemplate.cpp index e69338a7730..66321d3ec24 100644 --- a/clang/lib/AST/DeclTemplate.cpp +++ b/clang/lib/AST/DeclTemplate.cpp @@ -92,7 +92,7 @@ RedeclarableTemplateDecl::CommonBase *RedeclarableTemplateDecl::getCommonPtr() { RedeclarableTemplateDecl *First = getCanonicalDecl(); if (First->CommonOrPrev.isNull()) { - CommonBase *CommonPtr = First->newCommon(); + CommonBase *CommonPtr = First->newCommon(getASTContext()); First->CommonOrPrev = CommonPtr; CommonPtr->Latest = First; } @@ -156,9 +156,10 @@ FunctionTemplateDecl *FunctionTemplateDecl::Create(ASTContext &C, return new (C) FunctionTemplateDecl(DC, L, Name, Params, Decl); } -RedeclarableTemplateDecl::CommonBase *FunctionTemplateDecl::newCommon() { - Common *CommonPtr = new (getASTContext()) Common; - getASTContext().AddDeallocation(DeallocateCommon, CommonPtr); +RedeclarableTemplateDecl::CommonBase * +FunctionTemplateDecl::newCommon(ASTContext &C) { + Common *CommonPtr = new (C) Common; + C.AddDeallocation(DeallocateCommon, CommonPtr); return CommonPtr; } @@ -188,9 +189,10 @@ ClassTemplateDecl *ClassTemplateDecl::Create(ASTContext &C, return New; } -RedeclarableTemplateDecl::CommonBase *ClassTemplateDecl::newCommon() { - Common *CommonPtr = new (getASTContext()) Common; - getASTContext().AddDeallocation(DeallocateCommon, CommonPtr); +RedeclarableTemplateDecl::CommonBase * +ClassTemplateDecl::newCommon(ASTContext &C) { + Common *CommonPtr = new (C) Common; + C.AddDeallocation(DeallocateCommon, CommonPtr); return CommonPtr; } |