[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang / test / AST / ast-dump-stmt.m
blob1d349ece966f8098a91086a4373a412e2925a0cf
1 // Test without serialization:
2 // RUN: %clang_cc1 -Wno-unused -fobjc-arc -fblocks -fobjc-exceptions -ast-dump -ast-dump-filter Test %s \
3 // RUN: | FileCheck -strict-whitespace %s
4 //
5 // Test with serialization:
6 // RUN: %clang_cc1 -Wno-unused -fobjc-arc -fblocks -fobjc-exceptions -emit-pch -o %t %s
7 // RUN: %clang_cc1 -x objective-c -Wno-unused -fobjc-arc -fblocks -fobjc-exceptions -include-pch %t \
8 // RUN: -ast-dump-all -ast-dump-filter Test /dev/null \
9 // RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
10 // RUN: | FileCheck -strict-whitespace %s
12 void TestBlockExpr(int x) {
13   ^{ x; };
15 // CHECK:      FunctionDecl{{.*}}TestBlockExpr
16 // CHECK:      BlockExpr{{.*}} 'void (^)(void)'
17 // CHECK-NEXT:   BlockDecl
19 void TestExprWithCleanup(int x) {
20   ^{ x; };
22 // CHECK:      FunctionDecl{{.*}}TestExprWithCleanup
23 // CHECK:      ExprWithCleanups
24 // CHECK-NEXT:   cleanup Block
25 // CHECK-NEXT:   BlockExpr
27 @interface A
28 @end
30 void TestObjCAtCatchStmt(void) {
31   @try {
32   } @catch(A *a) {
33   } @catch(...) {
34   } @finally {
35   }
37 // CHECK:      FunctionDecl{{.*}}TestObjCAtCatchStmt
38 // CHECK:      ObjCAtTryStmt
39 // CHECK-NEXT:   CompoundStmt
40 // CHECK-NEXT:   ObjCAtCatchStmt{{.*}}
41 // CHECK-NEXT:     VarDecl{{.*}}a
42 // CHECK-NEXT:     CompoundStmt
43 // CHECK-NEXT:   ObjCAtCatchStmt{{.*}} catch all
44 // CHECK-NEXT:     CompoundStmt
45 // CHECK-NEXT:   ObjCAtFinallyStmt
47 typedef struct {
48   id f;
49 } S;
51 id TestCompoundLiteral(id a) {
52   return ((S){ .f = a }).f;
55 // CHECK:     FunctionDecl{{.*}}TestCompoundLiteral
56 // CHECK:       ExprWithCleanups
57 // CHECK-NEXT:    cleanup CompoundLiteralExpr
58 // CHECK:           CompoundLiteralExpr{{.*}}'S':'S' lvalue