summaryrefslogtreecommitdiffstats
path: root/clang/test/Index/index-templates.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-08-31 17:01:39 +0000
committerDouglas Gregor <dgregor@apple.com>2010-08-31 17:01:39 +0000
commit713602bb09f09b971f55c565e7bbdf2aba173e98 (patch)
tree084fe44d30c91c1d1c11e8d94369ec3f963394e9 /clang/test/Index/index-templates.cpp
parent04dc9572601fb6ae976156326797a8888e00edad (diff)
downloadbcm5719-llvm-713602bb09f09b971f55c565e7bbdf2aba173e98.tar.gz
bcm5719-llvm-713602bb09f09b971f55c565e7bbdf2aba173e98.zip
Implement basic support for indexing function templates in
libclang. This includes: - Cursor kind for function templates, with visitation logic - Cursor kinds for template parameters, with visitation logic - Visitation logic for template specialization types, qualified type locations - USR generation for function templates, template specialization types, template parameter types. Also happens to fix PR7804, which I tripped across while testing. llvm-svn: 112604
Diffstat (limited to 'clang/test/Index/index-templates.cpp')
-rw-r--r--clang/test/Index/index-templates.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/clang/test/Index/index-templates.cpp b/clang/test/Index/index-templates.cpp
new file mode 100644
index 00000000000..90e0c352bc0
--- /dev/null
+++ b/clang/test/Index/index-templates.cpp
@@ -0,0 +1,22 @@
+// Test is line- and column-sensitive. See run lines below.
+
+template<typename T, T Value, template<typename U, U ValU> class X>
+void f(X<T, Value> 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]
+// CHECK-LOAD: index-templates.cpp:3:24: NonTypeTemplateParameter=Value:3:24 (Definition) Extent=[3:22 - 3:29]
+// FIXME: Need the template type parameter here
+// CHECK-LOAD: index-templates.cpp:3:66: TemplateTemplateParameter=X:3:66 (Definition) Extent=[3:31 - 3:67]
+// CHECK-LOAD: index-templates.cpp:4:20: ParmDecl=x:4:20 (Definition) Extent=[4:8 - 4:21]
+// FIXME: Need the template declaration here.
+// FIXME: Need the template type parameter here
+// CHECK-LOAD: index-templates.cpp:4:13: DeclRefExpr=Value:3:24 Extent=[4:13 - 4:18]
+
+// 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]
+// CHECK-USRS: index-templates.cpp c:index-templates.cpp@79 Extent=[3:19 - 3:20]
+// CHECK-USRS: index-templates.cpp c:index-templates.cpp@82 Extent=[3:22 - 3:29]
+// CHECK-USRS: index-templates.cpp c:index-templates.cpp@91 Extent=[3:31 - 3:67]
+// CHECK-USRS: index-templates.cpp c:index-templates.cpp@136@FT@>3#T#Nt0.0#t>2#T#Nt1.0f#>t0.22t0.0#@x Extent=[4:8 - 4:21]
OpenPOWER on IntegriCloud