diff options
author | Douglas Gregor <dgregor@apple.com> | 2012-01-07 09:11:48 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2012-01-07 09:11:48 +0000 |
commit | f5c9f9fd6f5e2850b9b0f19283430245b696c6e5 (patch) | |
tree | eaf11351dbbffd667d8f3cbf539cf784d629e925 /lib/Serialization/ASTWriterDecl.cpp | |
parent | 72899c34e3d1abfffa241ad0ce5c4bf175e5ea51 (diff) |
Switch NamespaceDecl from its own hand-rolled redeclaration chain over
to Redeclarable<NamespaceDecl>, so that we benefit from the improveed
redeclaration deserialization and merging logic provided by
Redeclarable<T>. Otherwise, no functionality change.
As a drive-by fix, collapse the "inline" bit into the low bit of the
original namespace/anonymous namespace, saving 8 bytes per
NamespaceDecl on x86_64.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147729 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Serialization/ASTWriterDecl.cpp')
-rw-r--r-- | lib/Serialization/ASTWriterDecl.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/Serialization/ASTWriterDecl.cpp b/lib/Serialization/ASTWriterDecl.cpp index 7ff1d5aab0..45ce7799fa 100644 --- a/lib/Serialization/ASTWriterDecl.cpp +++ b/lib/Serialization/ASTWriterDecl.cpp @@ -802,18 +802,14 @@ void ASTDeclWriter::VisitLabelDecl(LabelDecl *D) { void ASTDeclWriter::VisitNamespaceDecl(NamespaceDecl *D) { + VisitRedeclarable(D); VisitNamedDecl(D); Record.push_back(D->isInline()); Writer.AddSourceLocation(D->getLocStart(), Record); Writer.AddSourceLocation(D->getRBraceLoc(), Record); - Writer.AddDeclRef(D->getNextNamespace(), Record); - // Only write one reference--original or anonymous - Record.push_back(D->isOriginalNamespace()); if (D->isOriginalNamespace()) Writer.AddDeclRef(D->getAnonymousNamespace(), Record); - else - Writer.AddDeclRef(D->getOriginalNamespace(), Record); Code = serialization::DECL_NAMESPACE; if (Writer.hasChain() && !D->isOriginalNamespace() && @@ -836,7 +832,8 @@ void ASTDeclWriter::VisitNamespaceDecl(NamespaceDecl *D) { } } - if (Writer.hasChain() && D->isAnonymousNamespace() && !D->getNextNamespace()){ + if (Writer.hasChain() && D->isAnonymousNamespace() && + D == D->getMostRecentDeclaration()) { // This is a most recent reopening of the anonymous namespace. If its parent // is in a previous PCH (or is the TU), mark that parent for update, because // the original namespace always points to the latest re-opening of its |