get-cursor.cpp revision 93798e25d68e2d146cff9bd0355d4b7b1ca765f1
1// Test is line- and column-sensitive. Run lines are below.
2
3struct X {
4  X();
5  X(int);
6  X(int, int);
7  X(const X&);
8};
9
10X getX(int value) {
11  switch (value) {
12  case 1: return X(value);
13  case 2: return X(value, value);
14  case 3: return (X)value;
15  default: break;
16  }
17  return X();
18}
19
20// RUN: c-index-test -cursor-at=%s:12:20 %s | FileCheck -check-prefix=CHECK-VALUE-REF %s
21// RUN: c-index-test -cursor-at=%s:13:21 %s | FileCheck -check-prefix=CHECK-VALUE-REF %s
22// RUN: c-index-test -cursor-at=%s:13:28 %s | FileCheck -check-prefix=CHECK-VALUE-REF %s
23// RUN: c-index-test -cursor-at=%s:14:23 %s | FileCheck -check-prefix=CHECK-VALUE-REF %s
24// CHECK-VALUE-REF: DeclRefExpr=value:10:12
25
26// RUN: c-index-test -cursor-at=%s:12:18 %s | FileCheck -check-prefix=CHECK-CONSTRUCTOR1 %s
27// RUN: c-index-test -cursor-at=%s:13:18 %s | FileCheck -check-prefix=CHECK-CONSTRUCTOR2 %s
28// RUN: c-index-test -cursor-at=%s:14:19 %s | FileCheck -check-prefix=CHECK-CONSTRUCTOR1 %s
29// RUN: c-index-test -cursor-at=%s:17:10 %s | FileCheck -check-prefix=CHECK-CONSTRUCTOR3 %s
30// CHECK-TYPE-REF: TypeRef=struct X:3:8
31// CHECK-CONSTRUCTOR1: CallExpr=X:5:3
32// CHECK-CONSTRUCTOR2: CallExpr=X:6:3
33// CHECK-CONSTRUCTOR3: CallExpr=X:4:3
34