diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-11-09 21:35:27 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-11-09 21:35:27 +0000 |
commit | ff4393c1cea81b94ac081bed5c49b8126f12fae8 (patch) | |
tree | a1f473fc31b914aecbdb21a8025c65ee3c39b05c /lib/Sema/SemaCodeComplete.cpp | |
parent | d411b3f746e612294bd5f0843d83e8c215f7fe58 (diff) |
Make sure that we look into nested, transparent declaration contexts
when looking for a name within a given DeclContext. Now enumerators
will show up in code-completion results.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86591 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaCodeComplete.cpp')
-rw-r--r-- | lib/Sema/SemaCodeComplete.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/Sema/SemaCodeComplete.cpp b/lib/Sema/SemaCodeComplete.cpp index c6323956cc..072dfe9b73 100644 --- a/lib/Sema/SemaCodeComplete.cpp +++ b/lib/Sema/SemaCodeComplete.cpp @@ -473,17 +473,24 @@ static unsigned CollectMemberLookupResults(DeclContext *Ctx, for (DeclContext *CurCtx = Ctx->getPrimaryContext(); CurCtx; CurCtx = CurCtx->getNextContext()) { for (DeclContext::decl_iterator D = CurCtx->decls_begin(), - DEnd = CurCtx->decls_end(); + DEnd = CurCtx->decls_end(); D != DEnd; ++D) { if (NamedDecl *ND = dyn_cast<NamedDecl>(*D)) Results.MaybeAddResult(Result(ND, Rank, 0, InBaseClass), CurContext); + + // Visit transparent contexts inside this context. + if (DeclContext *InnerCtx = dyn_cast<DeclContext>(*D)) { + if (InnerCtx->isTransparentContext()) + CollectMemberLookupResults(InnerCtx, Rank, CurContext, Visited, + Results, InBaseClass); + } } } // Traverse the contexts of inherited classes. if (CXXRecordDecl *Record = dyn_cast<CXXRecordDecl>(Ctx)) { for (CXXRecordDecl::base_class_iterator B = Record->bases_begin(), - BEnd = Record->bases_end(); + BEnd = Record->bases_end(); B != BEnd; ++B) { QualType BaseType = B->getType(); |