[cfe-commits] r72313 - in /cfe/trunk: lib/CodeGen/CGExpr.cpp test/CodeGenObjC/blocks-2.m
Daniel Dunbar
daniel at zuster.org
Fri May 22 19:49:03 PDT 2009
Author: ddunbar
Date: Fri May 22 21:49:02 2009
New Revision: 72313
URL: http://llvm.org/viewvc/llvm-project?rev=72313&view=rev
Log:
Initialize Obj-C GC attributes when emitting BlockDeclRefExprs.
- Otherwise we may incorrectly miss generation of some write barriers.
Added:
cfe/trunk/test/CodeGenObjC/blocks-2.m
Modified:
cfe/trunk/lib/CodeGen/CGExpr.cpp
Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=72313&r1=72312&r2=72313&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Fri May 22 21:49:02 2009
@@ -723,7 +723,9 @@
}
LValue CodeGenFunction::EmitBlockDeclRefLValue(const BlockDeclRefExpr *E) {
- return LValue::MakeAddr(GetAddrOfBlockDecl(E), 0);
+ return LValue::MakeAddr(GetAddrOfBlockDecl(E),
+ E->getType().getCVRQualifiers(),
+ getContext().getObjCGCAttrKind(E->getType()));
}
LValue CodeGenFunction::EmitUnaryOpLValue(const UnaryOperator *E) {
Added: cfe/trunk/test/CodeGenObjC/blocks-2.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/blocks-2.m?rev=72313&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenObjC/blocks-2.m (added)
+++ cfe/trunk/test/CodeGenObjC/blocks-2.m Fri May 22 21:49:02 2009
@@ -0,0 +1,11 @@
+// RUN: clang-cc %s -emit-llvm -o %t -fobjc-gc -fblocks -triple i386-apple-darwin10 &&
+// RUN: grep "objc_assign_strongCast" %t | count 2 &&
+// RUN: true
+
+// This should generate a strong cast.
+
+id test3(id x) {
+ __block id result;
+ ^{ result = x; }();
+ return result;
+}
More information about the cfe-commits
mailing list