aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-09-13 22:52:57 +0000
committerDouglas Gregor <dgregor@apple.com>2010-09-13 22:52:57 +0000
commit1f60d9ea523fc321d811fe880ba9a1ec74fa8f9b (patch)
tree0573659048cae0b5bc818e56867a465458899703 /test
parentdacd24775d9654c3fe5dc2a01640c2b2aab2bead (diff)
Introduce a new kind of cursor into libclang, which covers a reference
to an "overloaded" set of declarations. This cursor kind works for unresolved references to functions/templates (e.g., a call within a template), using declarations, and Objective-C class and protocol forward declarations. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113805 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/Index/TestClassDecl.m2
-rw-r--r--test/Index/TestClassForwardDecl.m2
-rw-r--r--test/Index/index-templates.cpp21
-rw-r--r--test/Index/load-namespaces.cpp2
4 files changed, 24 insertions, 3 deletions
diff --git a/test/Index/TestClassDecl.m b/test/Index/TestClassDecl.m
index 09a7d48cfd..8cbe5cd5e9 100644
--- a/test/Index/TestClassDecl.m
+++ b/test/Index/TestClassDecl.m
@@ -16,7 +16,7 @@ void function(Foo * arg)
}
// CHECK-scan: [1:1 - 8:1] Invalid Cursor => NoDeclFound
-// CHECK-scan: [8:1 - 8:8] UnexposedDecl=:8:1
+// CHECK-scan: [8:1 - 8:8] UnexposedDecl=[10:12]
// CHECK-scan: [8:8 - 8:11] ObjCClassRef=Foo:10:12
// CHECK-scan: [8:11 - 10:1] Invalid Cursor => NoDeclFound
// CHECK-scan: [10:1 - 11:5] ObjCInterfaceDecl=Foo:10:12
diff --git a/test/Index/TestClassForwardDecl.m b/test/Index/TestClassForwardDecl.m
index 325a4236a5..a042bd873d 100644
--- a/test/Index/TestClassForwardDecl.m
+++ b/test/Index/TestClassForwardDecl.m
@@ -13,7 +13,7 @@ void function(Foo * arg)
}
// CHECK-scan: [1:1 - 8:1] Invalid Cursor => NoDeclFound
-// CHECK-scan: [8:1 - 8:8] UnexposedDecl=:8:1
+// CHECK-scan: [8:1 - 8:8] UnexposedDecl=[8:8]
// CHECK-scan: [8:8 - 8:11] ObjCClassRef=Foo:8:8
// CHECK-scan: [8:11 - 10:6] Invalid Cursor => NoDeclFound
// CHECK-scan: [10:6 - 10:15] FunctionDecl=function:10:6 (Definition)
diff --git a/test/Index/index-templates.cpp b/test/Index/index-templates.cpp
index 12c4a9bf53..fd0f5ab25d 100644
--- a/test/Index/index-templates.cpp
+++ b/test/Index/index-templates.cpp
@@ -55,6 +55,23 @@ void template_exprs() {
Z4().getAs<Unsigned>();
}
+template<typename T> void swap(T&, T&);
+template<typename T, typename U> void swap(Y<T, U>&, Y<T, U>&);
+void swap(Z4&, Z4&);
+
+struct Z5 {
+ int f(int);
+ float f(float);
+};
+
+template<typename T>
+void unresolved_exprs(T &x) {
+ swap(x, x);
+ Z5 z5;
+ z5.f(x);
+ swap<T>(x, x);
+}
+
// RUN: c-index-test -test-load-source all %s | FileCheck -check-prefix=CHECK-LOAD %s
// CHECK-LOAD: index-templates.cpp:4:6: FunctionTemplate=f:4:6 Extent=[3:1 - 4:22]
// CHECK-LOAD: index-templates.cpp:3:19: TemplateTypeParameter=T:3:19 (Definition) Extent=[3:19 - 3:20]
@@ -119,6 +136,10 @@ void template_exprs() {
// CHECK-LOAD: index-templates.cpp:55:8: MemberRefExpr=getAs:50:26 Extent=[55:3 - 55:23]
// CHECK-LOAD: index-templates.cpp:55:3: CallExpr= Extent=[55:3 - 55:7]
// CHECK-LOAD: index-templates.cpp:55:14: TypeRef=Unsigned:42:18 Extent=[55:14 - 55:22]
+// CHECK-LOAD: index-templates.cpp:68:6: FunctionTemplate=unresolved_exprs:68:6 (Definition)
+// CHECK-LOAD: index-templates.cpp:69:3: OverloadedDeclRef=swap[60:6, 59:39, 58:27]
+// CHECK-LOAD: index-templates.cpp:71:6: OverloadedDeclRef=f[63:7, 64:9]
+// CHECK-LOAD: index-templates.cpp:72:3: OverloadedDeclRef=swap[58:27, 59:39]
// RUN: c-index-test -test-load-source-usrs all %s | FileCheck -check-prefix=CHECK-USRS %s
// CHECK-USRS: index-templates.cpp c:@FT@>3#T#Nt0.0#t>2#T#Nt1.0f#>t0.22t0.0# Extent=[3:1 - 4:22]
diff --git a/test/Index/load-namespaces.cpp b/test/Index/load-namespaces.cpp
index 241e2413a7..31e2fce735 100644
--- a/test/Index/load-namespaces.cpp
+++ b/test/Index/load-namespaces.cpp
@@ -41,7 +41,7 @@ namespace my_rel_ops = std::rel_ops;
// CHECK: load-namespaces.cpp:18:11: Namespace=std:18:11 (Definition) Extent=[18:11 - 20:2]
// CHECK: load-namespaces.cpp:19:7: FunctionDecl=g:19:7 Extent=[19:7 - 19:13]
// CHECK: load-namespaces.cpp:19:12: ParmDecl=:19:12 (Definition) Extent=[19:9 - 19:13]
-// CHECK: load-namespaces.cpp:22:12: UsingDeclaration=g:22:12 Extent=[22:1 - 22:13]
+// CHECK: load-namespaces.cpp:22:12: UsingDeclaration=g[10:8, 19:7] Extent=[22:1 - 22:13]
// CHECK: load-namespaces.cpp:22:7: NamespaceRef=std:18:11 Extent=[22:7 - 22:10]
// CHECK: load-namespaces.cpp:24:11: FunctionDecl=g:24:11 (Definition) Extent=[24:11 - 25:2]
// CHECK: load-namespaces.cpp:24:6: NamespaceRef=std:18:11 Extent=[24:6 - 24:9]