41 lines · cpp
1// Test without serialization:2// RUN: %clang_cc1 -triple x86_64-unknown-unknown -Wno-unused-value -ast-dump %s \3// RUN: | FileCheck %s4//5// Test with serialization:6// RUN: %clang_cc1 -triple x86_64-unknown-unknown -Wno-unused-value -emit-pch -o %t %s7// 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 %s10 11// Make sure that the Stmt * for the body of the LambdaExpr is12// equal to the Stmt * for the body of the call operator.13void Test0() {14 []() {15 return 42;16 };17}18 19// CHECK: FunctionDecl {{.*}} Test020//21// CHECK: CXXMethodDecl {{.*}} operator() 'int () const' inline22// CHECK-NEXT: CompoundStmt 0x[[TMP0:.*]]23// CHECK: IntegerLiteral {{.*}} 'int' 4224//25// CHECK: CompoundStmt 0x[[TMP0]]26// Check: IntegerLiteral {{.*}} 'int' 4227 28void Test1() {29 [](auto x) { return x; };30}31 32// CHECK: FunctionDecl {{.*}} Test133//34// CHECK: CXXMethodDecl {{.*}} operator() 'auto (auto) const' inline35// 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