[llvm-branch-commits] [cfe-branch] r119823 - in /cfe/branches/Apple/whitney: lib/CodeGen/CGExpr.cpp test/CodeGenObjCXX/refence-assign-write-barrier.mm
Daniel Dunbar
daniel at zuster.org
Fri Nov 19 11:49:35 PST 2010
Author: ddunbar
Date: Fri Nov 19 13:49:35 2010
New Revision: 119823
URL: http://llvm.org/viewvc/llvm-project?rev=119823&view=rev
Log:
Merge r119751:
--
Author: Fariborz Jahanian <fjahanian at apple.com>
Date: Thu Nov 18 22:39:16 2010 +0000
Fix a bug where write-barriers for assignment through reference
types was not being generated for objc pointers.
// rdar://8681766.
Added:
cfe/branches/Apple/whitney/test/CodeGenObjCXX/refence-assign-write-barrier.mm
Modified:
cfe/branches/Apple/whitney/lib/CodeGen/CGExpr.cpp
Modified: cfe/branches/Apple/whitney/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/lib/CodeGen/CGExpr.cpp?rev=119823&r1=119822&r2=119823&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/branches/Apple/whitney/lib/CodeGen/CGExpr.cpp Fri Nov 19 13:49:35 2010
@@ -1199,7 +1199,7 @@
V = Builder.CreateLoad(V, "tmp");
LValue LV = MakeAddrLValue(V, E->getType(), Alignment);
- if (NonGCable) {
+ if (NonGCable && !VD->getType()->isReferenceType()) {
LV.getQuals().removeObjCGCAttr();
LV.setNonGC(true);
}
Added: cfe/branches/Apple/whitney/test/CodeGenObjCXX/refence-assign-write-barrier.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/test/CodeGenObjCXX/refence-assign-write-barrier.mm?rev=119823&view=auto
==============================================================================
--- cfe/branches/Apple/whitney/test/CodeGenObjCXX/refence-assign-write-barrier.mm (added)
+++ cfe/branches/Apple/whitney/test/CodeGenObjCXX/refence-assign-write-barrier.mm Fri Nov 19 13:49:35 2010
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -fobjc-gc -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s
+// rdar://8681766
+
+ at interface NSArray
+- (NSArray*) retain;
+- (void) release;
+ at end
+
+void NSAssignArray(NSArray*& target, NSArray* newValue)
+{
+ if (target == newValue)
+ return;
+
+ NSArray* oldValue = target;
+
+ target = [newValue retain];
+
+ [oldValue release];
+}
+// CHECK: {{call.* @objc_assign_strongCast}}
More information about the llvm-branch-commits
mailing list