Home | History | Annotate | Download | only in Index
      1 // Test is line- and column-sensitive. Run lines are below.
      2 
      3 struct X {
      4   X();
      5   X(int);
      6   X(int, int);
      7   X(const X&);
      8 };
      9 
     10 X 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 struct Y {
     21   int member;
     22 
     23   X getX();
     24 };
     25 
     26 X Y::getX() {
     27   return member;
     28 }
     29 
     30 struct YDerived : Y {
     31   X getAnotherX() { return member; }
     32 };
     33 
     34 void test() {
     35   X foo;
     36 }
     37 
     38 // RUN: c-index-test -cursor-at=%s:12:20 %s | FileCheck -check-prefix=CHECK-VALUE-REF %s
     39 // RUN: c-index-test -cursor-at=%s:13:21 %s | FileCheck -check-prefix=CHECK-VALUE-REF %s
     40 // RUN: c-index-test -cursor-at=%s:13:28 %s | FileCheck -check-prefix=CHECK-VALUE-REF %s
     41 // RUN: c-index-test -cursor-at=%s:14:23 %s | FileCheck -check-prefix=CHECK-VALUE-REF %s
     42 // CHECK-VALUE-REF: DeclRefExpr=value:10:12
     43 
     44 // RUN: c-index-test -cursor-at=%s:12:18 %s | FileCheck -check-prefix=CHECK-CONSTRUCTOR1 %s
     45 // RUN: c-index-test -cursor-at=%s:13:18 %s | FileCheck -check-prefix=CHECK-CONSTRUCTOR2 %s
     46 // RUN: c-index-test -cursor-at=%s:14:19 %s | FileCheck -check-prefix=CHECK-CONSTRUCTOR1 %s
     47 // RUN: c-index-test -cursor-at=%s:17:10 %s | FileCheck -check-prefix=CHECK-CONSTRUCTOR3 %s
     48 // CHECK-TYPE-REF: TypeRef=struct X:3:8
     49 // CHECK-CONSTRUCTOR1: CallExpr=X:5:3
     50 // CHECK-CONSTRUCTOR2: CallExpr=X:6:3
     51 // CHECK-CONSTRUCTOR3: CallExpr=X:4:3
     52 
     53 // RUN: c-index-test -cursor-at=%s:23:3 %s | FileCheck -check-prefix=CHECK-RETTYPE %s
     54 // RUN: c-index-test -cursor-at=%s:26:1 %s | FileCheck -check-prefix=CHECK-RETTYPE %s
     55 // CHECK-RETTYPE: TypeRef=struct X:3:8
     56 
     57 // RUN: c-index-test -cursor-at=%s:23:7 %s | FileCheck -check-prefix=CHECK-MEMFUNC-DECL %s
     58 // CHECK-MEMFUNC-DECL: CXXMethod=getX:23:5
     59 // RUN: c-index-test -cursor-at=%s:26:7 %s | FileCheck -check-prefix=CHECK-MEMFUNC-DEF %s
     60 // CHECK-MEMFUNC-DEF: CXXMethod=getX:26:6
     61 
     62 // RUN: c-index-test -cursor-at=%s:26:3 %s | FileCheck -check-prefix=CHECK-TYPEREF-Y %s
     63 // CHECK-TYPEREF-Y: TypeRef=struct Y:20:8
     64 
     65 // RUN: c-index-test -cursor-at=%s:27:10 %s | FileCheck -check-prefix=CHECK-IMPLICIT-MEMREF %s
     66 // RUN: c-index-test -cursor-at=%s:31:28 %s | FileCheck -check-prefix=CHECK-IMPLICIT-MEMREF %s
     67 // CHECK-IMPLICIT-MEMREF: MemberRefExpr=member:21:7
     68 
     69 // RUN: c-index-test -cursor-at=%s:35:5 %s | FileCheck -check-prefix=CHECK-DECL %s
     70 // CHECK-DECL: VarDecl=foo:35:5
     71