1011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor// Test is line- and column-sensitive; see below.
2011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor
3011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregortypedef int Integer;
4011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregorstruct X {
5011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor  void f() {
6011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor    int localA, localB;
7011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor    auto lambda = [&localA, localB] (Integer x) -> Integer {
8011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor      return localA + localB + x;
9011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor    };
10011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor  }
11011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor};
12011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor
13011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor// RUN: c-index-test -test-load-source all -std=c++11 %s | FileCheck -check-prefix=CHECK-LOAD %s
14011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor// CHECK-LOAD: cxx11-lambdas.cpp:7:19: LambdaExpr= Extent=[7:19 - 9:6]
15011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor// CHECK-LOAD: cxx11-lambdas.cpp:7:21: VariableRef=localA:6:9 Extent=[7:21 - 7:27]
16011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor// CHECK-LOAD: cxx11-lambdas.cpp:7:29: VariableRef=localB:6:17 Extent=[7:29 - 7:35]
17011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor// CHECK-LOAD: cxx11-lambdas.cpp:7:52: TypeRef=Integer:3:13 Extent=[7:52 - 7:59]
18011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor// CHECK-LOAD: cxx11-lambdas.cpp:7:46: ParmDecl=x:7:46 (Definition) Extent=[7:38 - 7:47]
19011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor// CHECK-LOAD: cxx11-lambdas.cpp:7:38: TypeRef=Integer:3:13 Extent=[7:38 - 7:45]
20011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor// CHECK-LOAD: cxx11-lambdas.cpp:7:60: CompoundStmt= Extent=[7:60 - 9:6]
21011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor// CHECK-LOAD: cxx11-lambdas.cpp:8:7: ReturnStmt= Extent=[8:7 - 8:33]
22011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor// CHECK-LOAD: cxx11-lambdas.cpp:8:14: DeclRefExpr=localA:6:9 Extent=[8:14 - 8:20]
23011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor// CHECK-LOAD: cxx11-lambdas.cpp:8:23: DeclRefExpr=localB:6:17 Extent=[8:23 - 8:29]
24011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor// CHECK-LOAD: cxx11-lambdas.cpp:8:32: DeclRefExpr=x:7:46 Extent=[8:32 - 8:33]
25011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor
26011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor// RUN: env CINDEXTEST_INDEXLOCALSYMBOLS=1 c-index-test -index-file -std=c++11 %s | FileCheck -check-prefix=CHECK-INDEX %s
27011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor// CHECK-INDEX: [indexEntityReference]: kind: variable | name: localA | USR: c:cxx11-lambdas.cpp@100@S@X@F@f#@localA | lang: C | cursor: VariableRef=localA:6:9 | loc: 7:21
28011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor// CHECK-INDEX: [indexEntityReference]: kind: variable | name: localB | USR: c:cxx11-lambdas.cpp@100@S@X@F@f#@localB | lang: C | cursor: VariableRef=localB:6:17 | loc: 7:29
29651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines// CHECK-INDEX: [indexEntityReference]: kind: typedef | name: Integer | USR: c:cxx11-lambdas.cpp@T@Integer | lang: C | cursor: TypeRef=Integer:3:13 | loc: 7:52
30651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines// CHECK-INDEX: [indexEntityReference]: kind: typedef | name: Integer | USR: c:cxx11-lambdas.cpp@T@Integer | lang: C | cursor: TypeRef=Integer:3:13 | loc: 7:38
31011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor// CHECK-INDEX: [indexEntityReference]: kind: variable | name: localA | USR: c:cxx11-lambdas.cpp@100@S@X@F@f#@localA | lang: C | cursor: DeclRefExpr=localA:6:9 | loc: 8:14
32011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor// CHECK-INDEX: [indexEntityReference]: kind: variable | name: localB | USR: c:cxx11-lambdas.cpp@100@S@X@F@f#@localB | lang: C | cursor: DeclRefExpr=localB:6:17 | loc: 8:23
33011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor// CHECK-INDEX: [indexEntityReference]: kind: variable | name: x | USR: c:cxx11-lambdas.cpp@157@S@X@F@f#@Ca@F@operator()#I#1@x | lang: C | cursor: DeclRefExpr=x:7:46 | loc: 8:32
34