diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-02-24 02:44:23 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-02-24 02:44:23 +0000 |
commit | e3536dda402a958ef1a71abce75e935a1752ac59 (patch) | |
tree | 069fdbc1b011812a40d5797ec452b081094528e6 /clang/lib/AST/DeclTemplate.cpp | |
parent | 5fb7d8b508189d12a3ed7b9d901f2a2d1c7d0a7b (diff) | |
download | bcm5719-llvm-e3536dda402a958ef1a71abce75e935a1752ac59.tar.gz bcm5719-llvm-e3536dda402a958ef1a71abce75e935a1752ac59.zip |
[modules] Ensure we've imported all declarations of a template before
attempting to lazily deserialize its specializations; otherwise, there might be
pending specializations that we don't know about yet.
llvm-svn: 230301
Diffstat (limited to 'clang/lib/AST/DeclTemplate.cpp')
-rw-r--r-- | clang/lib/AST/DeclTemplate.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/clang/lib/AST/DeclTemplate.cpp b/clang/lib/AST/DeclTemplate.cpp index 2c64e5933bd..6374a92621a 100644 --- a/clang/lib/AST/DeclTemplate.cpp +++ b/clang/lib/AST/DeclTemplate.cpp @@ -272,7 +272,11 @@ FunctionTemplateDecl::newCommon(ASTContext &C) const { } void FunctionTemplateDecl::LoadLazySpecializations() const { - Common *CommonPtr = getCommonPtr(); + // Grab the most recent declaration to ensure we've loaded any lazy + // redeclarations of this template. + // + // FIXME: Avoid walking the entire redeclaration chain here. + Common *CommonPtr = getMostRecentDecl()->getCommonPtr(); if (CommonPtr->LazySpecializations) { ASTContext &Context = getASTContext(); uint32_t *Specs = CommonPtr->LazySpecializations; @@ -342,7 +346,11 @@ ClassTemplateDecl *ClassTemplateDecl::CreateDeserialized(ASTContext &C, } void ClassTemplateDecl::LoadLazySpecializations() const { - Common *CommonPtr = getCommonPtr(); + // Grab the most recent declaration to ensure we've loaded any lazy + // redeclarations of this template. + // + // FIXME: Avoid walking the entire redeclaration chain here. + Common *CommonPtr = getMostRecentDecl()->getCommonPtr(); if (CommonPtr->LazySpecializations) { ASTContext &Context = getASTContext(); uint32_t *Specs = CommonPtr->LazySpecializations; @@ -966,7 +974,11 @@ VarTemplateDecl *VarTemplateDecl::CreateDeserialized(ASTContext &C, // TODO: Unify across class, function and variable templates? // May require moving this and Common to RedeclarableTemplateDecl. void VarTemplateDecl::LoadLazySpecializations() const { - Common *CommonPtr = getCommonPtr(); + // Grab the most recent declaration to ensure we've loaded any lazy + // redeclarations of this template. + // + // FIXME: Avoid walking the entire redeclaration chain here. + Common *CommonPtr = getMostRecentDecl()->getCommonPtr(); if (CommonPtr->LazySpecializations) { ASTContext &Context = getASTContext(); uint32_t *Specs = CommonPtr->LazySpecializations; |