[RISCV] Add shrinkwrap test cases showing gaps in current impl
[llvm-project.git] / clang / test / AST / ast-dump-lambda-body-not-duplicated.cpp
blob558455e239c74e1d631ece86a05f7ae5585f8004
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
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;
19 // CHECK: FunctionDecl {{.*}} Test0
21 // CHECK: CXXMethodDecl {{.*}} operator() 'int () const' inline
22 // CHECK-NEXT: CompoundStmt 0x[[TMP0:.*]]
23 // CHECK: IntegerLiteral {{.*}} 'int' 42
25 // CHECK: CompoundStmt 0x[[TMP0]]
26 // Check: IntegerLiteral {{.*}} 'int' 42
28 void Test1() {
29 [](auto x) { return x; };
32 // CHECK: FunctionDecl {{.*}} Test1
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'
39 // CHECK: CompoundStmt 0x[[TMP1]]
40 // CHECK: DeclRefExpr {{.*}} 'x' 'auto'