r340468 - [ASTImporter] Add test for ObjCAtTryStmt/ObjCAtCatchStmt/ObjCAtThrowStmt

Raphael Isemann via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 22 15:51:37 PDT 2018


Author: teemperor
Date: Wed Aug 22 15:51:37 2018
New Revision: 340468

URL: http://llvm.org/viewvc/llvm-project?rev=340468&view=rev
Log:
[ASTImporter] Add test for ObjCAtTryStmt/ObjCAtCatchStmt/ObjCAtThrowStmt

Reviewers: a.sidorin, a_sidorin

Reviewed By: a_sidorin

Subscribers: martong, cfe-commits

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

Added:
    cfe/trunk/test/Import/objc-try-catch/
    cfe/trunk/test/Import/objc-try-catch/Inputs/
    cfe/trunk/test/Import/objc-try-catch/Inputs/F.m
    cfe/trunk/test/Import/objc-try-catch/test.m

Added: cfe/trunk/test/Import/objc-try-catch/Inputs/F.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Import/objc-try-catch/Inputs/F.m?rev=340468&view=auto
==============================================================================
--- cfe/trunk/test/Import/objc-try-catch/Inputs/F.m (added)
+++ cfe/trunk/test/Import/objc-try-catch/Inputs/F.m Wed Aug 22 15:51:37 2018
@@ -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 {
+  }
+}

Added: cfe/trunk/test/Import/objc-try-catch/test.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Import/objc-try-catch/test.m?rev=340468&view=auto
==============================================================================
--- cfe/trunk/test/Import/objc-try-catch/test.m (added)
+++ cfe/trunk/test/Import/objc-try-catch/test.m Wed Aug 22 15:51:37 2018
@@ -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();
+}




More information about the cfe-commits mailing list