From bb853c79c0d61acaa0dd9aa4f77cded334166946 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Wed, 13 Aug 2014 01:23:33 +0000 Subject: [modules] When performing a lookup into a namespace, ensure that any later redefinitions of that namespace have already been loaded. When writing out the names in a namespace, if we see a name that is locally declared and had imported declarations merged on top of it, export the local declaration as the lookup result, because it will be the most recent declaration of that entity in the redeclaration chain of an importer of the module. llvm-svn: 215518 --- clang/lib/AST/DeclBase.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'clang/lib/AST/DeclBase.cpp') diff --git a/clang/lib/AST/DeclBase.cpp b/clang/lib/AST/DeclBase.cpp index 2b1506d191d..49d05d0d407 100644 --- a/clang/lib/AST/DeclBase.cpp +++ b/clang/lib/AST/DeclBase.cpp @@ -1296,6 +1296,11 @@ DeclContext::lookup(DeclarationName Name) { if (PrimaryContext != this) return PrimaryContext->lookup(Name); + // If this is a namespace, ensure that any later redeclarations of it have + // been loaded, since they may add names to the result of this lookup. + if (auto *ND = dyn_cast(this)) + (void)ND->getMostRecentDecl(); + if (hasExternalVisibleStorage()) { if (NeedToReconcileExternalVisibleStorage) reconcileExternalVisibleStorage(); -- cgit v1.2.3