diff options
| author | John McCall <rjmccall@apple.com> | 2015-10-21 18:06:31 +0000 |
|---|---|---|
| committer | John McCall <rjmccall@apple.com> | 2015-10-21 18:06:31 +0000 |
| commit | f8a9b66f658d791acebc1868d5ec2fcbe59c841d (patch) | |
| tree | 6867886fc91c336324ae718b6a62c536a00fe950 /clang/test/CodeGenObjCXX | |
| parent | 814236d6947dfcc4773517449da1e626e0472d3c (diff) | |
| download | bcm5719-llvm-f8a9b66f658d791acebc1868d5ec2fcbe59c841d.tar.gz bcm5719-llvm-f8a9b66f658d791acebc1868d5ec2fcbe59c841d.zip | |
In ARC, peephole the initialization of a __weak variable with
a value loaded from a __weak variable into a call to
objc_copyWeak or objc_moveWeak.
llvm-svn: 250916
Diffstat (limited to 'clang/test/CodeGenObjCXX')
| -rw-r--r-- | clang/test/CodeGenObjCXX/arc.mm | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/test/CodeGenObjCXX/arc.mm b/clang/test/CodeGenObjCXX/arc.mm index 4ce59df3e0f..e3a6349afaf 100644 --- a/clang/test/CodeGenObjCXX/arc.mm +++ b/clang/test/CodeGenObjCXX/arc.mm @@ -324,3 +324,13 @@ template void test40_helper<int>(); // CHECK-NEXT: [[T0:%.*]] = load i8*, i8** [[TEMP]] // CHECK-NEXT: call i8* @objc_retain(i8* [[T0]]) +// Check that moves out of __weak variables are compiled to use objc_moveWeak. +void test41(__weak id &&x) { + __weak id y = static_cast<__weak id &&>(x); +} +// CHECK-LABEL: define void @_Z6test41OU6__weakP11objc_object +// CHECK: [[X:%.*]] = alloca i8** +// CHECK: [[Y:%.*]] = alloca i8* +// CHECK: [[T0:%.*]] = load i8**, i8*** [[X]] +// CHECK-NEXT: call void @objc_moveWeak(i8** [[Y]], i8** [[T0]]) +// CHECK-NEXT: call void @objc_destroyWeak(i8** [[Y]]) |

