llvm-project/clang/test/CodeGenObjC/arc-blocks-exceptions.m
Nikita Popov 532dc62b90 [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC)
This adds -no-opaque-pointers to clang tests whose output will
change when opaque pointers are enabled by default. This is
intended to be part of the migration approach described in
https://discourse.llvm.org/t/enabling-opaque-pointers-by-default/61322/9.

The patch has been produced by replacing %clang_cc1 with
%clang_cc1 -no-opaque-pointers for tests that fail with opaque
pointers enabled. Worth noting that this doesn't cover all tests,
there's a remaining ~40 tests not using %clang_cc1 that will need
a followup change.

Differential Revision: https://reviews.llvm.org/D123115
2022-04-07 12:09:47 +02:00

36 lines
1.3 KiB
Objective-C

// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-apple-darwin10 -emit-llvm -fblocks -fobjc-arc -fobjc-runtime-has-weak -fexceptions -disable-llvm-passes -o - %s | FileCheck %s
void test1(_Bool c) {
void test1_fn(void (^blk)(void));
__weak id weakId = 0;
test1_fn(c ? ^{ (void)weakId; } : 0);
// CHECK: [[CLEANUP_COND:%.*]] = alloca i1
// CHECK-NEXT: [[CLEANUP_SAVE:%.*]] = alloca i8**
// CHECK: store i1 true, i1* [[CLEANUP_COND]]
// CHECK-NEXT: store i8** {{.*}}, i8*** [[CLEANUP_SAVE]]
// CHECK: invoke void @test1_fn(
// CHECK-NEXT: to label %[[INVOKE_CONT:.*]] unwind label %[[LANDING_PAD_LAB:.*]]
// CHECK: [[INVOKE_CONT]]:
// CHECK-NEXT: [[LOAD:%.*]] = load i1, i1* [[CLEANUP_COND]]
// CHECK-NEXT: br i1 [[LOAD]], label %[[END_OF_SCOPE_LAB:.*]], label
// CHECK: [[END_OF_SCOPE_LAB]]:
// CHECK-NEXT: [[LOAD:%.*]] = load i8**, i8*** [[CLEANUP_SAVE]]
// CHECK-NEXT: call void @llvm.objc.destroyWeak(i8** [[LOAD]])
// CHECK-NEXT: br label
// CHECK: [[LANDING_PAD_LAB]]:
// /* some EH stuff */
// CHECK: [[LOAD:%.*]] = load i1, i1* [[CLEANUP_COND]]
// CHECK-NEXT: br i1 [[LOAD]], label %[[EH_CLEANUP_LAB:.*]], label
// CHECK: [[EH_CLEANUP_LAB]]:
// CHECK-NEXT: [[LOAD:%.*]] = load i8**, i8*** [[CLEANUP_SAVE]]
// CHECK-NEXT: call void @llvm.objc.destroyWeak(i8** [[LOAD]])
// CHECK-NEXT: br label
}