[cfe-commits] r162083 - in /cfe/trunk: include/clang/AST/DeclLookups.h test/Index/complete-preamble.cpp test/Index/complete-preamble.h
Douglas Gregor
dgregor at apple.com
Thu Aug 16 22:26:33 PDT 2012
Author: dgregor
Date: Fri Aug 17 00:26:33 2012
New Revision: 162083
URL: http://llvm.org/viewvc/llvm-project?rev=162083&view=rev
Log:
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.
Added:
cfe/trunk/test/Index/complete-preamble.cpp (with props)
cfe/trunk/test/Index/complete-preamble.h (with props)
Modified:
cfe/trunk/include/clang/AST/DeclLookups.h
Modified: cfe/trunk/include/clang/AST/DeclLookups.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclLookups.h?rev=162083&r1=162082&r2=162083&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclLookups.h (original)
+++ cfe/trunk/include/clang/AST/DeclLookups.h Fri Aug 17 00:26:33 2012
@@ -67,7 +67,7 @@
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_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());
Added: cfe/trunk/test/Index/complete-preamble.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/complete-preamble.cpp?rev=162083&view=auto
==============================================================================
--- cfe/trunk/test/Index/complete-preamble.cpp (added)
+++ cfe/trunk/test/Index/complete-preamble.cpp Fri Aug 17 00:26:33 2012
@@ -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')
+
Propchange: cfe/trunk/test/Index/complete-preamble.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cfe/trunk/test/Index/complete-preamble.cpp
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cfe/trunk/test/Index/complete-preamble.cpp
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: cfe/trunk/test/Index/complete-preamble.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/complete-preamble.h?rev=162083&view=auto
==============================================================================
--- cfe/trunk/test/Index/complete-preamble.h (added)
+++ cfe/trunk/test/Index/complete-preamble.h Fri Aug 17 00:26:33 2012
@@ -0,0 +1,6 @@
+namespace std {
+ void wibble();
+}
+
+namespace std {
+}
Propchange: cfe/trunk/test/Index/complete-preamble.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cfe/trunk/test/Index/complete-preamble.h
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cfe/trunk/test/Index/complete-preamble.h
------------------------------------------------------------------------------
svn:mime-type = text/plain
More information about the cfe-commits
mailing list