[cfe-commits] r66322 - in /cfe/trunk/lib/CodeGen: CGBlocks.cpp CGDecl.cpp
Mike Stump
mrs at apple.com
Fri Mar 6 22:04:31 PST 2009
Author: mrs
Date: Sat Mar 7 00:04:31 2009
New Revision: 66322
URL: http://llvm.org/viewvc/llvm-project?rev=66322&view=rev
Log:
Remove some FIXMEs for block literals that should be close to working.
Modified:
cfe/trunk/lib/CodeGen/CGBlocks.cpp
cfe/trunk/lib/CodeGen/CGDecl.cpp
Modified: cfe/trunk/lib/CodeGen/CGBlocks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBlocks.cpp?rev=66322&r1=66321&r2=66322&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGBlocks.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBlocks.cpp Sat Mar 7 00:04:31 2009
@@ -254,8 +254,8 @@
if (BDRE->isByRef()) {
// FIXME: For only local, or all byrefs?
NoteForHelper[helpersize].flag = BLOCK_FIELD_IS_BYREF |
- (0?BLOCK_FIELD_IS_WEAK : 0);
- // FIXME: Add weak support
+ // FIXME: Someone double check this.
+ (VD->getType().isObjCGCWeak() ? BLOCK_FIELD_IS_WEAK : 0);
const llvm::Type *Ty = Types[i+5];
llvm::Value *Loc = LocalDeclMap[VD];
Loc = Builder.CreateStructGEP(Loc, 1, "forwarding");
@@ -484,7 +484,7 @@
ErrorUnsupported(E, "__block variable in block literal");
else if (!Enable__block && E->getType()->isBlockPointerType())
ErrorUnsupported(E, "block pointer in block literal");
- else if (E->getDecl()->getAttr<ObjCNSObjectAttr>() ||
+ else if (!Enable__block && E->getDecl()->getAttr<ObjCNSObjectAttr>() ||
getContext().isObjCNSObjectType(E->getType()))
ErrorUnsupported(E, "__attribute__((NSObject)) variable in block "
"literal");
@@ -946,11 +946,6 @@
V = Builder.CreateStructGEP(V, 6, "x");
V = Builder.CreateBitCast(V, PtrToInt8Ty);
- // FIXME: Move to other one.
- // int flag = BLOCK_FIELD_IS_BYREF;
- // FIXME: Add weak support
- if (0)
- flag |= BLOCK_FIELD_IS_WEAK;
flag |= BLOCK_BYREF_CALLER;
BuildBlockRelease(V, flag);
CGF.FinishFunction();
Modified: cfe/trunk/lib/CodeGen/CGDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDecl.cpp?rev=66322&r1=66321&r2=66322&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDecl.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDecl.cpp Sat Mar 7 00:04:31 2009
@@ -340,6 +340,7 @@
// The block literal will need a copy/destroy helper.
BlockHasCopyDispose = true;
+ needsDispose = true;
if (Ty->isBlockPointerType()) {
flag |= BLOCK_FIELD_IS_BLOCK;
@@ -348,7 +349,10 @@
flag |= BLOCK_FIELD_IS_OBJECT;
flags |= BLOCK_HAS_COPY_DISPOSE;
}
- // FIXME: Need to set BLOCK_FIELD_IS_WEAK as appropriate.
+
+ // FIXME: Someone double check this.
+ if (Ty.isObjCGCWeak())
+ flag |= BLOCK_FIELD_IS_WEAK;
int isa = 0;
if (flag&BLOCK_FIELD_IS_WEAK)
@@ -380,7 +384,6 @@
Builder.CreateStore(BuildbyrefDestroyHelper(DeclPtr->getType(), flag),
destroy_helper);
}
- needsDispose = true;
}
// Handle the cleanup attribute
More information about the cfe-commits
mailing list