John McCall | fc92920 | 2010-06-04 22:33:30 +0000 | [diff] [blame] | 1 | // RUN: c-index-test -test-load-source local -fblocks %s | FileCheck %s |
| 2 | |
| 3 | typedef int int_t; |
| 4 | struct foo { long x; }; |
| 5 | |
| 6 | void test() { |
| 7 | static struct foo _foo; |
Douglas Gregor | 38f28c1 | 2010-10-22 22:24:08 +0000 | [diff] [blame] | 8 | __block i = 0; |
| 9 | ^ int_t(struct foo *foo) { return (int_t) foo->x + i; }(&_foo); |
John McCall | fc92920 | 2010-06-04 22:33:30 +0000 | [diff] [blame] | 10 | } |
| 11 | |
Abramo Bagnara | ff676cb | 2011-03-08 08:55:46 +0000 | [diff] [blame] | 12 | // CHECK: blocks.c:6:6: FunctionDecl=test:6:6 (Definition) Extent=[6:1 - 10:2] |
Douglas Gregor | 42b2984 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 13 | // CHECK: blocks.c:6:13: CompoundStmt= Extent=[6:13 - 10:2] |
| 14 | // CHECK: blocks.c:7:3: DeclStmt= Extent=[7:3 - 7:26] |
Abramo Bagnara | ff676cb | 2011-03-08 08:55:46 +0000 | [diff] [blame] | 15 | // CHECK: blocks.c:7:21: VarDecl=_foo:7:21 (Definition) Extent=[7:3 - 7:25] |
John McCall | fc92920 | 2010-06-04 22:33:30 +0000 | [diff] [blame] | 16 | // CHECK: blocks.c:7:17: TypeRef=struct foo:4:8 Extent=[7:17 - 7:20] |
Abramo Bagnara | ff676cb | 2011-03-08 08:55:46 +0000 | [diff] [blame] | 17 | // CHECK: blocks.c:8:11: VarDecl=i:8:11 (Definition) Extent=[8:3 - 8:16] |
Douglas Gregor | 42b2984 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 18 | // CHECK: blocks.c:8:15: IntegerLiteral= Extent=[8:15 - 8:16] |
Douglas Gregor | 38f28c1 | 2010-10-22 22:24:08 +0000 | [diff] [blame] | 19 | // CHECK: blocks.c:9:3: CallExpr= Extent=[9:3 - 9:65] |
Douglas Gregor | 42b2984 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 20 | // CHECK: blocks.c:9:3: BlockExpr= Extent=[9:3 - 9:58] |
Douglas Gregor | 38f28c1 | 2010-10-22 22:24:08 +0000 | [diff] [blame] | 21 | // CHECK: blocks.c:9:5: TypeRef=int_t:3:13 Extent=[9:5 - 9:10] |
Abramo Bagnara | ff676cb | 2011-03-08 08:55:46 +0000 | [diff] [blame] | 22 | // CHECK: blocks.c:9:23: ParmDecl=foo:9:23 (Definition) Extent=[9:11 - 9:26] |
Douglas Gregor | 38f28c1 | 2010-10-22 22:24:08 +0000 | [diff] [blame] | 23 | // CHECK: blocks.c:9:18: TypeRef=struct foo:4:8 Extent=[9:18 - 9:21] |
Douglas Gregor | 42b2984 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 24 | // CHECK: blocks.c:9:28: CompoundStmt= Extent=[9:28 - 9:58] |
| 25 | // CHECK: blocks.c:9:30: ReturnStmt= Extent=[9:30 - 9:55] |
| 26 | // CHECK: blocks.c:9:37: BinaryOperator= Extent=[9:37 - 9:55] |
| 27 | // CHECK: blocks.c:9:37: CStyleCastExpr= Extent=[9:37 - 9:51] |
Douglas Gregor | 38f28c1 | 2010-10-22 22:24:08 +0000 | [diff] [blame] | 28 | // CHECK: blocks.c:9:38: TypeRef=int_t:3:13 Extent=[9:38 - 9:43] |
Douglas Gregor | 430d7a1 | 2011-07-25 17:48:11 +0000 | [diff] [blame] | 29 | // CHECK: blocks.c:9:50: MemberRefExpr=x:4:19 SingleRefName=[9:50 - 9:51] RefName=[9:50 - 9:51] Extent=[9:45 - 9:51] |
Douglas Gregor | 38f28c1 | 2010-10-22 22:24:08 +0000 | [diff] [blame] | 30 | // CHECK: blocks.c:9:45: DeclRefExpr=foo:9:23 Extent=[9:45 - 9:48] |
| 31 | // CHECK: blocks.c:9:54: DeclRefExpr=i:8:11 Extent=[9:54 - 9:55] |
Douglas Gregor | 42b2984 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 32 | // CHECK: blocks.c:9:59: UnaryOperator= Extent=[9:59 - 9:64] |
Douglas Gregor | 38f28c1 | 2010-10-22 22:24:08 +0000 | [diff] [blame] | 33 | // CHECK: blocks.c:9:60: DeclRefExpr=_foo:7:21 Extent=[9:60 - 9:64] |
| 34 | |