Douglas Gregor | 6cd24e2 | 2010-07-29 00:26:18 +0000 | [diff] [blame] | 1 | struct bonk { }; |
| 2 | void test(bonk X) { |
| 3 | X = X; |
Francois Pichet | 0a03a3f | 2010-12-08 09:11:05 +0000 | [diff] [blame] | 4 | __is_base_of(bonk, bonk); |
Douglas Gregor | 6cd24e2 | 2010-07-29 00:26:18 +0000 | [diff] [blame] | 5 | } |
| 6 | |
Chandler Carruth | d765061 | 2011-04-02 09:47:38 +0000 | [diff] [blame] | 7 | struct X { |
| 8 | X operator++(); |
| 9 | X operator++(int); |
| 10 | }; |
| 11 | void test2(X x) { |
| 12 | ++(x); |
| 13 | (x)++; |
| 14 | } |
| 15 | |
| 16 | struct S1 { void f(); }; |
| 17 | struct S2 { S1 *operator->(); }; |
| 18 | void test3(S2 s2) { |
| 19 | s2->f(); |
Argyrios Kyrtzidis | 5517b89 | 2011-06-27 19:42:20 +0000 | [diff] [blame] | 20 | X foo; |
Chandler Carruth | d765061 | 2011-04-02 09:47:38 +0000 | [diff] [blame] | 21 | } |
| 22 | |
Argyrios Kyrtzidis | 5517b89 | 2011-06-27 19:42:20 +0000 | [diff] [blame] | 23 | // RUN: c-index-test -test-annotate-tokens=%s:1:1:21:1 %s | FileCheck %s |
Douglas Gregor | 6cd24e2 | 2010-07-29 00:26:18 +0000 | [diff] [blame] | 24 | // CHECK: Keyword: "struct" [1:1 - 1:7] StructDecl=bonk:1:8 (Definition) |
| 25 | // CHECK: Identifier: "bonk" [1:8 - 1:12] StructDecl=bonk:1:8 (Definition) |
| 26 | // CHECK: Punctuation: "{" [1:13 - 1:14] StructDecl=bonk:1:8 (Definition) |
| 27 | // CHECK: Punctuation: "}" [1:15 - 1:16] StructDecl=bonk:1:8 (Definition) |
| 28 | // CHECK: Punctuation: ";" [1:16 - 1:17] |
| 29 | // CHECK: Keyword: "void" [2:1 - 2:5] FunctionDecl=test:2:6 (Definition) |
| 30 | // CHECK: Identifier: "test" [2:6 - 2:10] FunctionDecl=test:2:6 (Definition) |
| 31 | // CHECK: Punctuation: "(" [2:10 - 2:11] FunctionDecl=test:2:6 (Definition) |
| 32 | // CHECK: Identifier: "bonk" [2:11 - 2:15] TypeRef=struct bonk:1:8 |
| 33 | // CHECK: Identifier: "X" [2:16 - 2:17] ParmDecl=X:2:16 (Definition) |
| 34 | // CHECK: Punctuation: ")" [2:17 - 2:18] FunctionDecl=test:2:6 (Definition) |
Douglas Gregor | 42b2984 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 35 | // CHECK: Punctuation: "{" [2:19 - 2:20] CompoundStmt= |
Douglas Gregor | 6cd24e2 | 2010-07-29 00:26:18 +0000 | [diff] [blame] | 36 | // CHECK: Identifier: "X" [3:5 - 3:6] DeclRefExpr=X:2:16 |
Francois Pichet | 2346789 | 2010-12-08 09:04:37 +0000 | [diff] [blame] | 37 | // CHECK: Punctuation: "=" [3:7 - 3:8] CallExpr=operator=:1:8 |
Douglas Gregor | 6cd24e2 | 2010-07-29 00:26:18 +0000 | [diff] [blame] | 38 | // CHECK: Identifier: "X" [3:9 - 3:10] DeclRefExpr=X:2:16 |
Douglas Gregor | 42b2984 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 39 | // CHECK: Punctuation: ";" [3:10 - 3:11] CompoundStmt= |
Francois Pichet | 0a03a3f | 2010-12-08 09:11:05 +0000 | [diff] [blame] | 40 | // CHECK: Keyword: "__is_base_of" [4:5 - 4:17] UnexposedExpr= |
| 41 | // CHECK: Punctuation: "(" [4:17 - 4:18] UnexposedExpr= |
| 42 | // CHECK: Identifier: "bonk" [4:18 - 4:22] TypeRef=struct bonk:1:8 |
| 43 | // CHECK: Punctuation: "," [4:22 - 4:23] UnexposedExpr= |
| 44 | // CHECK: Identifier: "bonk" [4:24 - 4:28] TypeRef=struct bonk:1:8 |
| 45 | // CHECK: Punctuation: ")" [4:28 - 4:29] UnexposedExpr= |
Douglas Gregor | 42b2984 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 46 | // CHECK: Punctuation: ";" [4:29 - 4:30] CompoundStmt= |
| 47 | // CHECK: Punctuation: "}" [5:1 - 5:2] CompoundStmt= |
Chandler Carruth | d765061 | 2011-04-02 09:47:38 +0000 | [diff] [blame] | 48 | // CHECK: Keyword: "struct" [7:1 - 7:7] StructDecl=X:7:8 (Definition) |
| 49 | // CHECK: Identifier: "X" [7:8 - 7:9] StructDecl=X:7:8 (Definition) |
| 50 | // CHECK: Punctuation: "{" [7:10 - 7:11] StructDecl=X:7:8 (Definition) |
| 51 | // CHECK: Identifier: "X" [8:3 - 8:4] TypeRef=struct X:7:8 |
| 52 | // CHECK: Keyword: "operator" [8:5 - 8:13] CXXMethod=operator++:8:5 |
| 53 | // CHECK: Punctuation: "++" [8:13 - 8:15] CXXMethod=operator++:8:5 |
| 54 | // CHECK: Punctuation: "(" [8:15 - 8:16] CXXMethod=operator++:8:5 |
| 55 | // CHECK: Punctuation: ")" [8:16 - 8:17] CXXMethod=operator++:8:5 |
| 56 | // CHECK: Punctuation: ";" [8:17 - 8:18] StructDecl=X:7:8 (Definition) |
| 57 | // CHECK: Identifier: "X" [9:3 - 9:4] TypeRef=struct X:7:8 |
| 58 | // CHECK: Keyword: "operator" [9:5 - 9:13] CXXMethod=operator++:9:5 |
| 59 | // CHECK: Punctuation: "++" [9:13 - 9:15] CXXMethod=operator++:9:5 |
| 60 | // CHECK: Punctuation: "(" [9:15 - 9:16] CXXMethod=operator++:9:5 |
| 61 | // CHECK: Keyword: "int" [9:16 - 9:19] ParmDecl=:9:19 (Definition) |
| 62 | // CHECK: Punctuation: ")" [9:19 - 9:20] ParmDecl=:9:19 (Definition) |
| 63 | // CHECK: Punctuation: ";" [9:20 - 9:21] StructDecl=X:7:8 (Definition) |
| 64 | // CHECK: Punctuation: "}" [10:1 - 10:2] StructDecl=X:7:8 (Definition) |
| 65 | // CHECK: Punctuation: ";" [10:2 - 10:3] |
| 66 | // CHECK: Keyword: "void" [11:1 - 11:5] FunctionDecl=test2:11:6 (Definition) |
| 67 | // CHECK: Identifier: "test2" [11:6 - 11:11] FunctionDecl=test2:11:6 (Definition) |
| 68 | // CHECK: Punctuation: "(" [11:11 - 11:12] FunctionDecl=test2:11:6 (Definition) |
| 69 | // CHECK: Identifier: "X" [11:12 - 11:13] TypeRef=struct X:7:8 |
| 70 | // CHECK: Identifier: "x" [11:14 - 11:15] ParmDecl=x:11:14 (Definition) |
| 71 | // CHECK: Punctuation: ")" [11:15 - 11:16] FunctionDecl=test2:11:6 (Definition) |
Douglas Gregor | 42b2984 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 72 | // CHECK: Punctuation: "{" [11:17 - 11:18] CompoundStmt= |
Chandler Carruth | d765061 | 2011-04-02 09:47:38 +0000 | [diff] [blame] | 73 | // CHECK: Punctuation: "++" [12:3 - 12:5] CallExpr=operator++:8:5 |
Douglas Gregor | 42b2984 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 74 | // CHECK: Punctuation: "(" [12:5 - 12:6] ParenExpr= |
Chandler Carruth | d765061 | 2011-04-02 09:47:38 +0000 | [diff] [blame] | 75 | // CHECK: Identifier: "x" [12:6 - 12:7] DeclRefExpr=x:11:14 |
Douglas Gregor | 42b2984 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 76 | // CHECK: Punctuation: ")" [12:7 - 12:8] ParenExpr= |
| 77 | // CHECK: Punctuation: ";" [12:8 - 12:9] CompoundStmt= |
| 78 | // CHECK: Punctuation: "(" [13:3 - 13:4] ParenExpr= |
Chandler Carruth | d765061 | 2011-04-02 09:47:38 +0000 | [diff] [blame] | 79 | // CHECK: Identifier: "x" [13:4 - 13:5] DeclRefExpr=x:11:14 |
Douglas Gregor | 42b2984 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 80 | // CHECK: Punctuation: ")" [13:5 - 13:6] ParenExpr= |
Chandler Carruth | d765061 | 2011-04-02 09:47:38 +0000 | [diff] [blame] | 81 | // CHECK: Punctuation: "++" [13:6 - 13:8] CallExpr=operator++:9:5 |
Douglas Gregor | 42b2984 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 82 | // CHECK: Punctuation: ";" [13:8 - 13:9] CompoundStmt= |
| 83 | // CHECK: Punctuation: "}" [14:1 - 14:2] CompoundStmt= |
Chandler Carruth | d765061 | 2011-04-02 09:47:38 +0000 | [diff] [blame] | 84 | // CHECK: Keyword: "struct" [16:1 - 16:7] StructDecl=S1:16:8 (Definition) |
| 85 | // CHECK: Identifier: "S1" [16:8 - 16:10] StructDecl=S1:16:8 (Definition) |
| 86 | // CHECK: Punctuation: "{" [16:11 - 16:12] StructDecl=S1:16:8 (Definition) |
| 87 | // CHECK: Keyword: "void" [16:13 - 16:17] CXXMethod=f:16:18 |
| 88 | // CHECK: Identifier: "f" [16:18 - 16:19] CXXMethod=f:16:18 |
| 89 | // CHECK: Punctuation: "(" [16:19 - 16:20] CXXMethod=f:16:18 |
| 90 | // CHECK: Punctuation: ")" [16:20 - 16:21] CXXMethod=f:16:18 |
| 91 | // CHECK: Punctuation: ";" [16:21 - 16:22] StructDecl=S1:16:8 (Definition) |
| 92 | // CHECK: Punctuation: "}" [16:23 - 16:24] StructDecl=S1:16:8 (Definition) |
| 93 | // CHECK: Punctuation: ";" [16:24 - 16:25] |
| 94 | // CHECK: Keyword: "struct" [17:1 - 17:7] StructDecl=S2:17:8 (Definition) |
| 95 | // CHECK: Identifier: "S2" [17:8 - 17:10] StructDecl=S2:17:8 (Definition) |
| 96 | // CHECK: Punctuation: "{" [17:11 - 17:12] StructDecl=S2:17:8 (Definition) |
| 97 | // CHECK: Identifier: "S1" [17:13 - 17:15] TypeRef=struct S1:16:8 |
| 98 | // CHECK: Punctuation: "*" [17:16 - 17:17] CXXMethod=operator->:17:17 |
| 99 | // CHECK: Keyword: "operator" [17:17 - 17:25] CXXMethod=operator->:17:17 |
| 100 | // CHECK: Punctuation: "->" [17:25 - 17:27] CXXMethod=operator->:17:17 |
| 101 | // CHECK: Punctuation: "(" [17:27 - 17:28] CXXMethod=operator->:17:17 |
| 102 | // CHECK: Punctuation: ")" [17:28 - 17:29] CXXMethod=operator->:17:17 |
| 103 | // CHECK: Punctuation: ";" [17:29 - 17:30] StructDecl=S2:17:8 (Definition) |
| 104 | // CHECK: Punctuation: "}" [17:31 - 17:32] StructDecl=S2:17:8 (Definition) |
| 105 | // CHECK: Punctuation: ";" [17:32 - 17:33] |
| 106 | // CHECK: Keyword: "void" [18:1 - 18:5] FunctionDecl=test3:18:6 (Definition) |
| 107 | // CHECK: Identifier: "test3" [18:6 - 18:11] FunctionDecl=test3:18:6 (Definition) |
| 108 | // CHECK: Punctuation: "(" [18:11 - 18:12] FunctionDecl=test3:18:6 (Definition) |
| 109 | // CHECK: Identifier: "S2" [18:12 - 18:14] TypeRef=struct S2:17:8 |
| 110 | // CHECK: Identifier: "s2" [18:15 - 18:17] ParmDecl=s2:18:15 (Definition) |
| 111 | // CHECK: Punctuation: ")" [18:17 - 18:18] FunctionDecl=test3:18:6 (Definition) |
Douglas Gregor | 42b2984 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 112 | // CHECK: Punctuation: "{" [18:19 - 18:20] CompoundStmt= |
Chandler Carruth | d765061 | 2011-04-02 09:47:38 +0000 | [diff] [blame] | 113 | // CHECK: Identifier: "s2" [19:3 - 19:5] DeclRefExpr=s2:18:15 |
| 114 | // CHECK: Punctuation: "->" [19:5 - 19:7] MemberRefExpr=f:16:18 |
| 115 | // CHECK: Identifier: "f" [19:7 - 19:8] MemberRefExpr=f:16:18 |
| 116 | // CHECK: Punctuation: "(" [19:8 - 19:9] CallExpr=f:16:18 |
| 117 | // CHECK: Punctuation: ")" [19:9 - 19:10] CallExpr=f:16:18 |
Douglas Gregor | 42b2984 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 118 | // CHECK: Punctuation: ";" [19:10 - 19:11] CompoundStmt= |
Argyrios Kyrtzidis | 5517b89 | 2011-06-27 19:42:20 +0000 | [diff] [blame] | 119 | // CHECK: Identifier: "X" [20:3 - 20:4] TypeRef=struct X:7:8 |
| 120 | // CHECK: Identifier: "foo" [20:5 - 20:8] VarDecl=foo:20:5 (Definition) |
Douglas Gregor | 42b2984 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 121 | // CHECK: Punctuation: ";" [20:8 - 20:9] DeclStmt= |
| 122 | // CHECK: Punctuation: "}" [21:1 - 21:2] CompoundStmt= |