1 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fblocks -fobjc-arc -fobjc-runtime-has-weak -std=c++11 -o - %s | FileCheck %s
3 __attribute((objc_root_class)) @interface A @end
6 // Ensure that type differences don't cause an assert here.
7 void test0(__weak B **src) {
10 // CHECK-LABEL: define{{.*}} void @_Z5test0PU6__weakP1B(
11 // CHECK: [[SRC:%.*]] = alloca ptr, align 8
12 // CHECK: [[DEST:%.*]] = alloca ptr, align 8
13 // CHECK: [[T0:%.*]] = load ptr, ptr [[SRC]], align 8
14 // CHECK-NEXT: call void @llvm.objc.copyWeak(ptr [[DEST]], ptr [[T0]])
15 // CHECK: call void @llvm.objc.destroyWeak(ptr [[DEST]])
17 void test1(__weak B **src) {
18 __weak A *dest = static_cast<__weak B*&&>(*src);
20 // CHECK-LABEL: define{{.*}} void @_Z5test1PU6__weakP1B(
21 // CHECK: [[SRC:%.*]] = alloca ptr, align 8
22 // CHECK: [[DEST:%.*]] = alloca ptr, align 8
23 // CHECK: [[T0:%.*]] = load ptr, ptr [[SRC]], align 8
24 // CHECK-NEXT: call void @llvm.objc.moveWeak(ptr [[DEST]], ptr [[T0]])
25 // CHECK: call void @llvm.objc.destroyWeak(ptr [[DEST]])