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 | 6b5415196327fa8ef00f028ba175fafef1738ae1 (patch) | |
tree | 692274d3fe4cd8731c3e2d1ca6f59db279f072f5 /lib/AST/TemplateName.cpp | |
parent | 4566d1a0e5750dc21bd9120be3e1a98d60db5620 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113391 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/TemplateName.cpp')
-rw-r--r-- | lib/AST/TemplateName.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/AST/TemplateName.cpp b/lib/AST/TemplateName.cpp index ef7b315314..439f4e81ad 100644 --- a/lib/AST/TemplateName.cpp +++ b/lib/AST/TemplateName.cpp @@ -44,8 +44,14 @@ TemplateDecl *TemplateName::getAsTemplateDecl() const { bool TemplateName::isDependent() const { if (TemplateDecl *Template = getAsTemplateDecl()) { - return isa<TemplateTemplateParmDecl>(Template) || - Template->getDeclContext()->isDependentContext(); + if (isa<TemplateTemplateParmDecl>(Template)) + return true; + // FIXME: Hack, getDeclContext() can be null if Template is still + // initializing due to PCH reading, so we check it before using it. + // Should probably modify TemplateSpecializationType to allow constructing + // it without the isDependent() checking. + return Template->getDeclContext() && + Template->getDeclContext()->isDependentContext(); } assert(!getAsOverloadedTemplate() && |