aboutsummaryrefslogtreecommitdiff
path: root/lib/Serialization/ASTWriterDecl.cpp
diff options
context:
space:
mode:
authorSebastian Redl <sebastian.redl@getdesigned.at>2011-04-24 16:28:21 +0000
committerSebastian Redl <sebastian.redl@getdesigned.at>2011-04-24 16:28:21 +0000
commit74b485a2b36c0ba33a85ba9cb6e36e0e3a1fada1 (patch)
tree2ae6a9beed2f1f94018617e807eb4b4c2eb1e4a7 /lib/Serialization/ASTWriterDecl.cpp
parent7c0837f29680f387fc4969b48a3643fe00b9b541 (diff)
Set the correct anonymous namespace (must be last reopening), and behave correctly in the presence of the ever-annoying linkage specifications.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130105 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Serialization/ASTWriterDecl.cpp')
-rw-r--r--lib/Serialization/ASTWriterDecl.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/Serialization/ASTWriterDecl.cpp b/lib/Serialization/ASTWriterDecl.cpp
index db72be3f58..df83f2f694 100644
--- a/lib/Serialization/ASTWriterDecl.cpp
+++ b/lib/Serialization/ASTWriterDecl.cpp
@@ -708,11 +708,13 @@ void ASTDeclWriter::VisitNamespaceDecl(NamespaceDecl *D) {
}
}
- if (Writer.hasChain() && D->isOriginalNamespace() &&
- D->isAnonymousNamespace()) {
- // This is an original anonymous namespace. If its parent is in a previous
- // PCH (or is the TU), mark that parent for update.
- Decl *Parent = cast<Decl>(D->getParent()->getPrimaryContext());
+ if (Writer.hasChain() && D->isAnonymousNamespace() && !D->getNextNamespace()){
+ // 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
+ // anonymous namespace.
+ Decl *Parent = cast<Decl>(
+ D->getParent()->getRedeclContext()->getPrimaryContext());
if (Parent->getPCHLevel() > 0) {
ASTWriter::UpdateRecord &Record = Writer.DeclUpdates[Parent];
Record.push_back(UPD_CXX_ADDED_ANONYMOUS_NAMESPACE);