summaryrefslogtreecommitdiff
path: root/test/CodeGenObjCXX
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-12-10 00:23:21 +0000
committerDouglas Gregor <dgregor@apple.com>2011-12-10 00:23:21 +0000
commit92be2a5f4e938fc512683cd4e7dfd4e6789eb787 (patch)
tree0a69bdda32880a4ab4519df7ae3723c3c5f65142 /test/CodeGenObjCXX
parent001f628a693960380e37c2b58a1009da77d7e425 (diff)
downloadclang-92be2a5f4e938fc512683cd4e7dfd4e6789eb787.tar.gz
clang-92be2a5f4e938fc512683cd4e7dfd4e6789eb787.tar.bz2
clang-92be2a5f4e938fc512683cd4e7dfd4e6789eb787.tar.xz
When we manage to re-use an expression during tree transformation (=
template instantiation), and that expression might produce a temporary, invoke MaybeBindToTemporary. Otherwise, we forget to destroy objects, release objects, etc. Fixes <rdar://problem/10531073>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146301 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenObjCXX')
-rw-r--r--test/CodeGenObjCXX/arc.mm15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/CodeGenObjCXX/arc.mm b/test/CodeGenObjCXX/arc.mm
index 8f3aa711d6..6c6b8617ca 100644
--- a/test/CodeGenObjCXX/arc.mm
+++ b/test/CodeGenObjCXX/arc.mm
@@ -209,3 +209,18 @@ template void test37<Test37>(Test37 *a);
// This bitcast is for the final release.
// CHECK-LP64: [[T0:%.*]] = bitcast [[NSARRAY]]* [[COLL]] to i8*
// CHECK-LP64-NEXT: call void @objc_release(i8* [[T0]])
+
+template<typename T>
+void send_release() {
+ [Test37 array];
+}
+
+// CHECK: define weak_odr void @_Z12send_releaseIiEvv(
+// CHECK: call %0* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend
+// CHECK-NEXT: bitcast
+// CHECK-NEXT: call i8* @objc_retainAutoreleasedReturnValue
+// CHECK-NEXT: bitcast
+// CHECK-NEXT: bitcast
+// CHECK-NEXT: call void @objc_release
+// CHECK-NEXT: ret void
+template void send_release<int>();