diff options
Diffstat (limited to 'test/Index/annotate-tokens.cpp')
-rw-r--r-- | test/Index/annotate-tokens.cpp | 55 |
1 files changed, 54 insertions, 1 deletions
diff --git a/test/Index/annotate-tokens.cpp b/test/Index/annotate-tokens.cpp index 3062901b7c..16726547a2 100644 --- a/test/Index/annotate-tokens.cpp +++ b/test/Index/annotate-tokens.cpp @@ -20,7 +20,15 @@ void test3(S2 s2) { X foo; } -// RUN: c-index-test -test-annotate-tokens=%s:1:1:21:1 %s | FileCheck %s +template <bool (*tfn)(X*)> +struct TS { + void foo(); +}; + +template <bool (*tfn)(X*)> +void TS<tfn>::foo() {} + +// RUN: c-index-test -test-annotate-tokens=%s:1:1:30:1 %s -fno-delayed-template-parsing | FileCheck %s // CHECK: Keyword: "struct" [1:1 - 1:7] StructDecl=bonk:1:8 (Definition) // CHECK: Identifier: "bonk" [1:8 - 1:12] StructDecl=bonk:1:8 (Definition) // CHECK: Punctuation: "{" [1:13 - 1:14] StructDecl=bonk:1:8 (Definition) @@ -120,3 +128,48 @@ void test3(S2 s2) { // CHECK: Identifier: "foo" [20:5 - 20:8] VarDecl=foo:20:5 (Definition) // CHECK: Punctuation: ";" [20:8 - 20:9] DeclStmt= // CHECK: Punctuation: "}" [21:1 - 21:2] CompoundStmt= +// CHECK: Keyword: "template" [23:1 - 23:9] ClassTemplate=TS:24:8 (Definition) +// CHECK: Punctuation: "<" [23:10 - 23:11] ClassTemplate=TS:24:8 (Definition) +// CHECK: Keyword: "bool" [23:11 - 23:15] NonTypeTemplateParameter=tfn:23:18 (Definition) +// CHECK: Punctuation: "(" [23:16 - 23:17] NonTypeTemplateParameter=tfn:23:18 (Definition) +// CHECK: Punctuation: "*" [23:17 - 23:18] NonTypeTemplateParameter=tfn:23:18 (Definition) +// CHECK: Identifier: "tfn" [23:18 - 23:21] NonTypeTemplateParameter=tfn:23:18 (Definition) +// CHECK: Punctuation: ")" [23:21 - 23:22] NonTypeTemplateParameter=tfn:23:18 (Definition) +// CHECK: Punctuation: "(" [23:22 - 23:23] NonTypeTemplateParameter=tfn:23:18 (Definition) +// CHECK: Identifier: "X" [23:23 - 23:24] TypeRef=struct X:7:8 +// CHECK: Punctuation: "*" [23:24 - 23:25] ParmDecl=:23:25 (Definition) +// CHECK: Punctuation: ")" [23:25 - 23:26] ParmDecl=:23:25 (Definition) +// CHECK: Punctuation: ">" [23:26 - 23:27] ClassTemplate=TS:24:8 (Definition) +// CHECK: Keyword: "struct" [24:1 - 24:7] ClassTemplate=TS:24:8 (Definition) +// CHECK: Identifier: "TS" [24:8 - 24:10] ClassTemplate=TS:24:8 (Definition) +// CHECK: Punctuation: "{" [24:11 - 24:12] ClassTemplate=TS:24:8 (Definition) +// CHECK: Keyword: "void" [25:3 - 25:7] CXXMethod=foo:25:8 +// CHECK: Identifier: "foo" [25:8 - 25:11] CXXMethod=foo:25:8 +// CHECK: Punctuation: "(" [25:11 - 25:12] CXXMethod=foo:25:8 +// CHECK: Punctuation: ")" [25:12 - 25:13] CXXMethod=foo:25:8 +// CHECK: Punctuation: ";" [25:13 - 25:14] ClassTemplate=TS:24:8 (Definition) +// CHECK: Punctuation: "}" [26:1 - 26:2] ClassTemplate=TS:24:8 (Definition) +// CHECK: Punctuation: ";" [26:2 - 26:3] +// CHECK: Keyword: "template" [28:1 - 28:9] CXXMethod=foo:29:15 (Definition) +// CHECK: Punctuation: "<" [28:10 - 28:11] CXXMethod=foo:29:15 (Definition) +// CHECK: Keyword: "bool" [28:11 - 28:15] NonTypeTemplateParameter=tfn:28:18 (Definition) +// CHECK: Punctuation: "(" [28:16 - 28:17] NonTypeTemplateParameter=tfn:28:18 (Definition) +// CHECK: Punctuation: "*" [28:17 - 28:18] NonTypeTemplateParameter=tfn:28:18 (Definition) +// CHECK: Identifier: "tfn" [28:18 - 28:21] NonTypeTemplateParameter=tfn:28:18 (Definition) +// CHECK: Punctuation: ")" [28:21 - 28:22] NonTypeTemplateParameter=tfn:28:18 (Definition) +// CHECK: Punctuation: "(" [28:22 - 28:23] NonTypeTemplateParameter=tfn:28:18 (Definition) +// CHECK: Identifier: "X" [28:23 - 28:24] TypeRef=struct X:7:8 +// CHECK: Punctuation: "*" [28:24 - 28:25] ParmDecl=:28:25 (Definition) +// CHECK: Punctuation: ")" [28:25 - 28:26] ParmDecl=:28:25 (Definition) +// CHECK: Punctuation: ">" [28:26 - 28:27] CXXMethod=foo:29:15 (Definition) +// CHECK: Keyword: "void" [29:1 - 29:5] CXXMethod=foo:29:15 (Definition) +// CHECK: Identifier: "TS" [29:6 - 29:8] TemplateRef=TS:24:8 +// CHECK: Punctuation: "<" [29:8 - 29:9] CXXMethod=foo:29:15 (Definition) +// CHECK: Identifier: "tfn" [29:9 - 29:12] DeclRefExpr=tfn:28:18 +// CHECK: Punctuation: ">" [29:12 - 29:13] CXXMethod=foo:29:15 (Definition) +// CHECK: Punctuation: "::" [29:13 - 29:15] CXXMethod=foo:29:15 (Definition) +// CHECK: Identifier: "foo" [29:15 - 29:18] CXXMethod=foo:29:15 (Definition) +// CHECK: Punctuation: "(" [29:18 - 29:19] CXXMethod=foo:29:15 (Definition) +// CHECK: Punctuation: ")" [29:19 - 29:20] CXXMethod=foo:29:15 (Definition) +// CHECK: Punctuation: "{" [29:21 - 29:22] CompoundStmt= +// CHECK: Punctuation: "}" [29:22 - 29:23] CompoundStmt= |