Skip to content

Commit

Permalink
[ASTImporter] Add test for ObjCAtTryStmt/ObjCAtCatchStmt/ObjCAtThrowStmt
Browse files Browse the repository at this point in the history
Reviewers: a.sidorin, a_sidorin

Reviewed By: a_sidorin

Subscribers: martong, cfe-commits

Differential Revision: https://reviews.llvm.org/D51121

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@340468 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
Teemperor committed Aug 22, 2018
1 parent 0a451ff commit dcb6b80
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
28 changes: 28 additions & 0 deletions test/Import/objc-try-catch/Inputs/F.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
@interface Exception
@end
@interface OtherException
@end

void f() {
@try {
Exception *e;
@throw e;
}
@catch (Exception *varname) {
}
@finally {
}

@try {
}
@catch (Exception *varname1) {
@throw;
}
@catch (OtherException *varname2) {
}

@try {
}
@finally {
}
}
40 changes: 40 additions & 0 deletions test/Import/objc-try-catch/test.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// RUN: clang-import-test -x objective-c++ -Xcc -fobjc-exceptions -dump-ast -import %S/Inputs/F.m -expression %s | FileCheck %s

// CHECK: ObjCAtTryStmt
// CHECK-NEXT: CompoundStmt
// CHECK-NEXT: DeclStmt
// CHECK-NEXT: VarDecl
// CHECK-NEXT: ObjCAtThrowStmt
// CHECK-NEXT: ImplicitCastExpr
// CHECK-NEXT: DeclRefExpr
// CHECK-NEXT: ObjCAtCatchStmt
// CHECK-NEXT: VarDecl
// CHECK-SAME: varname
// CHECK-SAME: 'Exception *'
// CHECK-NEXT: CompoundStmt
// CHECK-NEXT: ObjCAtFinallyStmt
// CHECK-NEXT: CompoundStmt

// CHECK-NEXT: ObjCAtTryStmt
// CHECK-NEXT: CompoundStmt
// CHECK-NEXT: ObjCAtCatchStmt
// CHECK-NEXT: VarDecl
// CHECK-SAME: varname1
// CHECK-SAME: 'Exception *'
// CHECK-NEXT: CompoundStmt
// CHECK-NEXT: ObjCAtThrowStmt
// CHECK-NEXT: <<NULL>>
// CHECK-NEXT: ObjCAtCatchStmt
// CHECK-NEXT: VarDecl
// CHECK-SAME: varname2
// CHECK-SAME: 'OtherException *'
// CHECK-NEXT: CompoundStmt

// CHECK-NEXT: ObjCAtTryStmt
// CHECK-NEXT: CompoundStmt
// CHECK-NEXT: ObjCAtFinallyStmt
// CHECK-NEXT: CompoundStmt

void expr() {
f();
}

0 comments on commit dcb6b80

Please sign in to comment.