| 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 |
| 11 |
|
| 12 |
void TestBlockExpr(int x) { |
| 13 |
^{ x; }; |
| 14 |
} |
| 15 |
// CHECK: FunctionDecl{{.*}}TestBlockExpr |
| 16 |
// CHECK: BlockExpr{{.*}} 'void (^)(void)' |
| 17 |
// CHECK-NEXT: BlockDecl |
| 18 |
|
| 19 |
void TestExprWithCleanup(int x) { |
| 20 |
^{ x; }; |
| 21 |
} |
| 22 |
// CHECK: FunctionDecl{{.*}}TestExprWithCleanup |
| 23 |
// CHECK: ExprWithCleanups |
| 24 |
// CHECK-NEXT: cleanup Block |
| 25 |
// CHECK-NEXT: BlockExpr |
| 26 |
|
| 27 |
@interface A |
| 28 |
@end |
| 29 |
|
| 30 |
void TestObjCAtCatchStmt(void) { |
| 31 |
@try { |
| 32 |
} @catch(A *a) { |
| 33 |
} @catch(...) { |
| 34 |
} @finally { |
| 35 |
} |
| 36 |
} |
| 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 |
| 46 |
|
| 47 |
typedef struct { |
| 48 |
id f; |
| 49 |
} S; |
| 50 |
|
| 51 |
id TestCompoundLiteral(id a) { |
| 52 |
return ((S){ .f = a }).f; |
| 53 |
} |
| 54 |
|
| 55 |
// CHECK: FunctionDecl{{.*}}TestCompoundLiteral |
| 56 |
// CHECK: ExprWithCleanups |
| 57 |
// CHECK-NEXT: cleanup CompoundLiteralExpr |
| 58 |
// CHECK: CompoundLiteralExpr{{.*}}'S':'struct S' lvalue |