diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-03-23 20:41:56 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-03-23 20:41:56 +0000 |
commit | e3a97029da255fb8016f065a0e0fb2a78e087c13 (patch) | |
tree | 926730a97b2bcd30e394435c661f87938491d1ed /clang/lib/Serialization/ASTWriterDecl.cpp | |
parent | 6756a497a1f8a2809db1089832dc0c700a8502d5 (diff) | |
download | bcm5719-llvm-e3a97029da255fb8016f065a0e0fb2a78e087c13.tar.gz bcm5719-llvm-e3a97029da255fb8016f065a0e0fb2a78e087c13.zip |
If a name is injected into an imported inline namespace without reopening that
namespace, we need to update both the visible names of that namespace and of
its enclosing namespace set.
llvm-svn: 204570
Diffstat (limited to 'clang/lib/Serialization/ASTWriterDecl.cpp')
-rw-r--r-- | clang/lib/Serialization/ASTWriterDecl.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/clang/lib/Serialization/ASTWriterDecl.cpp b/clang/lib/Serialization/ASTWriterDecl.cpp index 4474328ec3b..f0b03128346 100644 --- a/clang/lib/Serialization/ASTWriterDecl.cpp +++ b/clang/lib/Serialization/ASTWriterDecl.cpp @@ -184,10 +184,15 @@ void ASTDeclWriter::VisitDecl(Decl *D) { // This happens when we instantiate a class with a friend declaration or a // function with a local extern declaration, for instance. if (D->isOutOfLine()) { - auto *NS = dyn_cast<NamespaceDecl>(D->getDeclContext()->getRedeclContext()); - // FIXME: Also update surrounding inline namespaces. - if (NS && NS->isFromASTFile()) + auto *DC = D->getDeclContext(); + while (auto *NS = dyn_cast<NamespaceDecl>(DC->getRedeclContext())) { + if (!NS->isFromASTFile()) + break; Writer.AddUpdatedDeclContext(NS->getPrimaryContext()); + if (!NS->isInlineNamespace()) + break; + DC = NS->getParent(); + } } } |