1 // Test without serialization: 2 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -Wno-unused-value -ast-dump %s \ 3 // RUN: | FileCheck %s 4 // 5 // Test with serialization: 6 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -Wno-unused-value -emit-pch -o %t %s 7 // RUN: %clang_cc1 -x c++ -triple x86_64-unknown-unknown -Wno-unused-value \ 8 // RUN: -include-pch %t -ast-dump-all /dev/null \ 9 // RUN: | FileCheck %s 10 11 // Make sure that the Stmt * for the body of the LambdaExpr is 12 // equal to the Stmt * for the body of the call operator. 13 void Test0() { 14 []() { 15 return 42; 16 }; 17 } 18 19 // CHECK: FunctionDecl {{.*}} Test0 20 // 21 // CHECK: CXXMethodDecl {{.*}} operator() 'int () const' inline 22 // CHECK-NEXT: CompoundStmt 0x[[TMP0:.*]] 23 // CHECK: IntegerLiteral {{.*}} 'int' 42 24 // 25 // CHECK: CompoundStmt 0x[[TMP0]] 26 // Check: IntegerLiteral {{.*}} 'int' 42 27 28 void Test1() { 29 [](auto x) { return x; }; 30 } 31 32 // CHECK: FunctionDecl {{.*}} Test1 33 // 34 // CHECK: CXXMethodDecl {{.*}} operator() 'auto (auto) const' inline 35 // CHECK-NEXT: ParmVarDecl {{.*}} referenced x 'auto' 36 // CHECK-NEXT: CompoundStmt 0x[[TMP1:.*]] 37 // CHECK: DeclRefExpr {{.*}} 'x' 'auto' 38 // 39 // CHECK: CompoundStmt 0x[[TMP1]] 40 // CHECK: DeclRefExpr {{.*}} 'x' 'auto' 41