Argyrios Kyrtzidis | aed123e | 2011-10-06 07:00:54 +0000 | [diff] [blame] | 1 | enum { |
| 2 | VALUE = 3 |
| 3 | }; |
| 4 | |
| 5 | extern int glob_x; |
| 6 | |
| 7 | int f(int x) { |
| 8 | return x+glob_x+VALUE; |
| 9 | } |
| 10 | |
| 11 | typedef struct { |
| 12 | int x; |
| 13 | int y; |
| 14 | } Vector; |
| 15 | |
| 16 | int vector_get_x(Vector v) { |
| 17 | int x = v.x; |
| 18 | return x; |
| 19 | } |
| 20 | |
| 21 | int f(int); |
| 22 | int f(int); |
| 23 | |
| 24 | // RUN: c-index-test \ |
| 25 | |
| 26 | // RUN: -file-refs-at=%s:2:5 \ |
| 27 | // CHECK: EnumConstantDecl=VALUE:2:3 (Definition) |
| 28 | // CHECK-NEXT: EnumConstantDecl=VALUE:2:3 (Definition) =[2:3 - 2:8] |
| 29 | // CHECK-NEXT: DeclRefExpr=VALUE:2:3 =[8:19 - 8:24] |
| 30 | |
| 31 | // RUN: -file-refs-at=%s:8:15 \ |
| 32 | // CHECK-NEXT: DeclRefExpr=glob_x:5:12 |
| 33 | // CHECK-NEXT: VarDecl=glob_x:5:12 =[5:12 - 5:18] |
| 34 | // CHECK-NEXT: DeclRefExpr=glob_x:5:12 =[8:12 - 8:18] |
| 35 | |
| 36 | // RUN: -file-refs-at=%s:8:10 \ |
| 37 | // CHECK-NEXT: DeclRefExpr=x:7:11 |
| 38 | // CHECK-NEXT: ParmDecl=x:7:11 (Definition) =[7:11 - 7:12] |
| 39 | // CHECK-NEXT: DeclRefExpr=x:7:11 =[8:10 - 8:11] |
| 40 | |
| 41 | // RUN: -file-refs-at=%s:12:7 \ |
| 42 | // CHECK-NEXT: FieldDecl=x:12:7 (Definition) |
| 43 | // CHECK-NEXT: FieldDecl=x:12:7 (Definition) =[12:7 - 12:8] |
| 44 | // CHECK-NEXT: MemberRefExpr=x:12:7 {{.*}} =[17:13 - 17:14] |
| 45 | |
| 46 | // RUN: -file-refs-at=%s:16:21 \ |
| 47 | // CHECK-NEXT: TypeRef=Vector:14:3 |
| 48 | // CHECK-NEXT: TypedefDecl=Vector:14:3 (Definition) =[14:3 - 14:9] |
| 49 | // CHECK-NEXT: TypeRef=Vector:14:3 =[16:18 - 16:24] |
| 50 | |
| 51 | // RUN: -file-refs-at=%s:21:5 \ |
| 52 | // CHECK-NEXT: FunctionDecl=f:21:5 |
| 53 | // CHECK-NEXT: FunctionDecl=f:7:5 (Definition) =[7:5 - 7:6] |
| 54 | // CHECK-NEXT: FunctionDecl=f:21:5 =[21:5 - 21:6] |
| 55 | // CHECK-NEXT: FunctionDecl=f:22:5 =[22:5 - 22:6] |
| 56 | |
| 57 | // RUN: %s | FileCheck %s |