diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-12-19 19:00:47 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-12-19 19:00:47 +0000 |
commit | fc529f7fcafe7da0b8a32621e13685891e8ce52a (patch) | |
tree | f2ddd830e7bbfe26fc1a5e900ef5755849433a71 /lib/Serialization/ASTWriterDecl.cpp | |
parent | f63b0a5f5445830a845895ee16f3affeaffd2e9d (diff) |
Once we have fully deserialized a redeclaration chain for something
with a definition pointer (e.g., C++ and Objective-C classes), zip
through the redeclaration chain to make sure that all of the
declarations point to the definition data.
As part of this, realized again why the first redeclaration of an
entity in a file is important, and brought back that idea.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146886 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Serialization/ASTWriterDecl.cpp')
-rw-r--r-- | lib/Serialization/ASTWriterDecl.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/Serialization/ASTWriterDecl.cpp b/lib/Serialization/ASTWriterDecl.cpp index cb1c6f0476..7ae601810b 100644 --- a/lib/Serialization/ASTWriterDecl.cpp +++ b/lib/Serialization/ASTWriterDecl.cpp @@ -1051,7 +1051,7 @@ void ASTDeclWriter::VisitTemplateDecl(TemplateDecl *D) { void ASTDeclWriter::VisitRedeclarableTemplateDecl(RedeclarableTemplateDecl *D) { // Emit data to initialize CommonOrPrev before VisitTemplateDecl so that // getCommonPtr() can be used while this is still initializing. - enum { FirstDeclaration, PointsToPrevious }; + enum { FirstDeclaration, FirstInFile, PointsToPrevious }; RedeclarableTemplateDecl *Prev = D->getPreviousDeclaration(); RedeclarableTemplateDecl *First = 0; if (!Prev) { @@ -1063,7 +1063,7 @@ void ASTDeclWriter::VisitRedeclarableTemplateDecl(RedeclarableTemplateDecl *D) { Record.push_back(D->isMemberSpecialization()); } else { First = D->getFirstDeclaration(); - Record.push_back(PointsToPrevious); + Record.push_back(Prev->isFromASTFile()? FirstInFile : PointsToPrevious); Writer.AddDeclRef(First, Record); Writer.AddDeclRef(Prev, Record); } @@ -1276,14 +1276,14 @@ void ASTDeclWriter::VisitDeclContext(DeclContext *DC, uint64_t LexicalOffset, template <typename T> void ASTDeclWriter::VisitRedeclarable(Redeclarable<T> *D) { - enum { FirstDeclaration = 0, PointsToPrevious }; + enum { FirstDeclaration = 0, FirstInFile, PointsToPrevious }; T *Prev = D->getPreviousDeclaration(); T *First = D->getFirstDeclaration(); if (!Prev) { Record.push_back(FirstDeclaration); } else { - Record.push_back(PointsToPrevious); + Record.push_back(Prev->isFromASTFile()? FirstInFile : PointsToPrevious); Writer.AddDeclRef(First, Record); Writer.AddDeclRef(D->getPreviousDeclaration(), Record); } |