aboutsummaryrefslogtreecommitdiff
path: root/test/Index/complete-exprs.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2012-03-27 23:34:16 +0000
committerDouglas Gregor <dgregor@apple.com>2012-03-27 23:34:16 +0000
commitba1030698dbc276db86b11c5329a1edee8a1805e (patch)
tree05795b249632407ea75e576411c56c9078255b80 /test/Index/complete-exprs.cpp
parent2259286fc5c1514089b17ec93e26ca56ba8ac2b6 (diff)
Introduce a new libclang API to determine the parent context of a code
completion item. For example, if the code completion itself represents a declaration in a namespace (say, std::vector), then this API retrieves the cursor kind and name of the namespace (std). Implements <rdar://problem/11121951>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153545 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Index/complete-exprs.cpp')
-rw-r--r--test/Index/complete-exprs.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/Index/complete-exprs.cpp b/test/Index/complete-exprs.cpp
index 6b7f2f9e91..de3aac52c0 100644
--- a/test/Index/complete-exprs.cpp
+++ b/test/Index/complete-exprs.cpp
@@ -34,6 +34,17 @@ void X::f() const {
}
+namespace N {
+ int x;
+ class C {
+ int member;
+
+ int f(int param) {
+ return member;
+ }
+ };
+}
+
// RUN: c-index-test -code-completion-at=%s:20:2 %s -std=c++0x | FileCheck -check-prefix=CHECK-CC1 %s
// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:20:2 -std=c++0x %s | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: NotImplemented:{ResultType size_t}{TypedText alignof}{LeftParen (}{Placeholder type}{RightParen )} (40)
@@ -65,3 +76,9 @@ void X::f() const {
// RUN: c-index-test -code-completion-at=%s:34:1 %s -std=c++0x | FileCheck -check-prefix=CHECK-CC4 %s
// CHECK-CC4: NotImplemented:{ResultType const X *}{TypedText this} (40)
+
+// RUN: c-index-test -code-completion-at=%s:43:14 %s | FileCheck -check-prefix=CHECK-CC5 %s
+// CHECK-CC5: FieldDecl:{ResultType int}{TypedText member} (8) (parent: ClassDecl 'N::C')
+// CHECK-CC5: ParmDecl:{ResultType int}{TypedText param} (8)
+// CHECK-CC5: StructDecl:{TypedText X} (50) (parent: TranslationUnit '(null)')
+// CHECK-CC5: VarDecl:{ResultType int}{TypedText x} (12) (parent: Namespace 'N')