Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Index / file-refs.c
blob23042ea06f694f27f7e3600c8df0b93ff381d0b3
1 enum {
2 VALUE = 3
3 };
5 extern int glob_x;
7 int f(int x) {
8 return x+glob_x+VALUE;
11 typedef struct {
12 int x;
13 int y;
14 } Vector;
16 int vector_get_x(Vector v) {
17 int x = v.x;
18 return x;
21 int f(int);
22 int f(int);
24 // RUN: c-index-test \
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]
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]
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]
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]
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]
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]
57 // RUN: %s | FileCheck %s