[PATCH] D51121: [ASTImporter] Add test for ObjCAtTryStmt/ObjCAtCatchStmt/ObjCAtThrowStmt

Raphael Isemann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 22 15:52:32 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rC340468: [ASTImporter] Add test for ObjCAtTryStmt/ObjCAtCatchStmt/ObjCAtThrowStmt (authored by teemperor, committed by ).

Repository:
  rC Clang

https://reviews.llvm.org/D51121

Files:
  test/Import/objc-try-catch/Inputs/F.m
  test/Import/objc-try-catch/test.m


Index: test/Import/objc-try-catch/test.m
===================================================================
--- test/Import/objc-try-catch/test.m
+++ test/Import/objc-try-catch/test.m
@@ -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();
+}
Index: test/Import/objc-try-catch/Inputs/F.m
===================================================================
--- test/Import/objc-try-catch/Inputs/F.m
+++ test/Import/objc-try-catch/Inputs/F.m
@@ -0,0 +1,28 @@
+ at interface Exception
+ at end
+ at interface OtherException
+ at end
+
+void f() {
+  @try {
+    Exception *e;
+    @throw e;
+  }
+  @catch (Exception *varname) {
+  }
+  @finally {
+  }
+
+  @try {
+  }
+  @catch (Exception *varname1) {
+    @throw;
+  }
+  @catch (OtherException *varname2) {
+  }
+
+  @try {
+  }
+  @finally {
+  }
+}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51121.162088.patch
Type: text/x-patch
Size: 1833 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180822/9aaea1af/attachment.bin>


More information about the cfe-commits mailing list