diff options
author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2011-04-24 16:28:21 +0000 |
---|---|---|
committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2011-04-24 16:28:21 +0000 |
commit | 74b485a2b36c0ba33a85ba9cb6e36e0e3a1fada1 (patch) | |
tree | 2ae6a9beed2f1f94018617e807eb4b4c2eb1e4a7 /lib/Serialization/ASTReaderDecl.cpp | |
parent | 7c0837f29680f387fc4969b48a3643fe00b9b541 (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/ASTReaderDecl.cpp')
-rw-r--r-- | lib/Serialization/ASTReaderDecl.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/Serialization/ASTReaderDecl.cpp b/lib/Serialization/ASTReaderDecl.cpp index 3d4e4cdd00..52eff1957d 100644 --- a/lib/Serialization/ASTReaderDecl.cpp +++ b/lib/Serialization/ASTReaderDecl.cpp @@ -1741,10 +1741,15 @@ void ASTDeclReader::UpdateDecl(Decl *D, const RecordData &Record) { case UPD_CXX_ADDED_ANONYMOUS_NAMESPACE: { NamespaceDecl *Anon = cast<NamespaceDecl>(Reader.GetDecl(Record[Idx++])); - if (TranslationUnitDecl *TU = dyn_cast<TranslationUnitDecl>(D)) - TU->setAnonymousNamespace(Anon); - else - cast<NamespaceDecl>(D)->OrigOrAnonNamespace.setPointer(Anon); + // Guard against these being loaded out of original order. Don't use + // getNextNamespace(), since it tries to access the context and can't in + // the middle of deserialization. + if (!Anon->NextNamespace) { + if (TranslationUnitDecl *TU = dyn_cast<TranslationUnitDecl>(D)) + TU->setAnonymousNamespace(Anon); + else + cast<NamespaceDecl>(D)->OrigOrAnonNamespace.setPointer(Anon); + } break; } } |