summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaphael Isemann <teemperor@gmail.com>2018-08-23 16:06:30 +0000
committerRaphael Isemann <teemperor@gmail.com>2018-08-23 16:06:30 +0000
commit121ecfd22c99297d7709f4be5b51e6992cc0c09e (patch)
tree7413b6dc4c5009574c5fdc26c929364ca52cc2f5
parent40aa86751ad87015a45426f25cd0ab3aa6d1b43b (diff)
downloadbcm5719-llvm-121ecfd22c99297d7709f4be5b51e6992cc0c09e.tar.gz
bcm5719-llvm-121ecfd22c99297d7709f4be5b51e6992cc0c09e.zip
Re-land [ASTImporter] Add test for ObjCAtTryStmt/ObjCAtCatchStmt/ObjCAtThrowStmt
Lands r340468 again, but this time we mark the test as unsupported on Windows because it seems that try/catch crashes CodeGen at the moment. llvm-svn: 340541
-rw-r--r--clang/test/Import/objc-try-catch/Inputs/F.m28
-rw-r--r--clang/test/Import/objc-try-catch/test.m43
2 files changed, 71 insertions, 0 deletions
diff --git a/clang/test/Import/objc-try-catch/Inputs/F.m b/clang/test/Import/objc-try-catch/Inputs/F.m
new file mode 100644
index 00000000000..5b8b67549b3
--- /dev/null
+++ b/clang/test/Import/objc-try-catch/Inputs/F.m
@@ -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 {
+ }
+}
diff --git a/clang/test/Import/objc-try-catch/test.m b/clang/test/Import/objc-try-catch/test.m
new file mode 100644
index 00000000000..216beba4f7f
--- /dev/null
+++ b/clang/test/Import/objc-try-catch/test.m
@@ -0,0 +1,43 @@
+// RUN: clang-import-test -x objective-c++ -Xcc -fobjc-exceptions -dump-ast -import %S/Inputs/F.m -expression %s | FileCheck %s
+
+// FIXME: Seems that Objective-C try/catch crash codegen on Windows. Reenable once this is fixed.
+// UNSUPPORTED: system-windows
+
+// 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();
+}
OpenPOWER on IntegriCloud