When we need the complete set of visible declarations from a

declaration context, check whether the primary context---not the
current context---has any external visible declarations. Fixes
PR13616.

llvm-svn: 162083
This commit is contained in:
Douglas Gregor 2012-08-17 05:26:33 +00:00
parent ebc3aa250b
commit cda209a944
3 changed files with 16 additions and 2 deletions

View File

@ -67,7 +67,7 @@ public:
DeclContext::all_lookups_iterator DeclContext::lookups_begin() const {
DeclContext *Primary = const_cast<DeclContext*>(this)->getPrimaryContext();
if (hasExternalVisibleStorage())
if (Primary->hasExternalVisibleStorage())
getParentASTContext().getExternalSource()->completeVisibleDeclsMap(Primary);
if (StoredDeclsMap *Map = Primary->buildLookup())
return all_lookups_iterator(Map->begin(), Map->end());
@ -76,7 +76,7 @@ DeclContext::all_lookups_iterator DeclContext::lookups_begin() const {
DeclContext::all_lookups_iterator DeclContext::lookups_end() const {
DeclContext *Primary = const_cast<DeclContext*>(this)->getPrimaryContext();
if (hasExternalVisibleStorage())
if (Primary->hasExternalVisibleStorage())
getParentASTContext().getExternalSource()->completeVisibleDeclsMap(Primary);
if (StoredDeclsMap *Map = Primary->buildLookup())
return all_lookups_iterator(Map->end(), Map->end());

View File

@ -0,0 +1,8 @@
#include "complete-preamble.h"
void f() {
std::
}
// RUN: env CINDEXTEST_EDITING=1 c-index-test -code-completion-at=%s:3:8 %s -o - | FileCheck -check-prefix=CC1 %s
// CHECK-CC1: {ResultType void}{TypedText wibble}{LeftParen (}{RightParen )} (50) (parent: Namespace 'std')

View File

@ -0,0 +1,6 @@
namespace std {
void wibble();
}
namespace std {
}