59 lines · plain
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 %s4//5// Test with serialization:6// RUN: %clang_cc1 -Wno-unused -fobjc-arc -fblocks -fobjc-exceptions -emit-pch -o %t %s7// 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 %s11 12void TestBlockExpr(int x) {13 ^{ x; };14}15// CHECK: FunctionDecl{{.*}}TestBlockExpr16// CHECK: BlockExpr{{.*}} 'void (^)(void)'17// CHECK-NEXT: BlockDecl18 19void TestExprWithCleanup(int x) {20 ^{ x; };21}22// CHECK: FunctionDecl{{.*}}TestExprWithCleanup23// CHECK: ExprWithCleanups24// CHECK-NEXT: cleanup Block25// CHECK-NEXT: BlockExpr26 27@interface A28@end29 30void TestObjCAtCatchStmt(void) {31 @try {32 } @catch(A *a) {33 } @catch(...) {34 } @finally {35 }36}37// CHECK: FunctionDecl{{.*}}TestObjCAtCatchStmt38// CHECK: ObjCAtTryStmt39// CHECK-NEXT: CompoundStmt40// CHECK-NEXT: ObjCAtCatchStmt{{.*}}41// CHECK-NEXT: VarDecl{{.*}}a42// CHECK-NEXT: CompoundStmt43// CHECK-NEXT: ObjCAtCatchStmt{{.*}} catch all44// CHECK-NEXT: CompoundStmt45// CHECK-NEXT: ObjCAtFinallyStmt46 47typedef struct {48 id f;49} S;50 51id TestCompoundLiteral(id a) {52 return ((S){ .f = a }).f;53}54 55// CHECK: FunctionDecl{{.*}}TestCompoundLiteral56// CHECK: ExprWithCleanups57// CHECK-NEXT: cleanup CompoundLiteralExpr58 // CHECK: CompoundLiteralExpr{{.*}}'S':'struct S' lvalue59