From 31937a5f7cb689377ff39397f4d0a8cff22d7359 Mon Sep 17 00:00:00 2001 From: Mike Stump Date: Mon, 2 Mar 2009 03:04:42 +0000 Subject: Push checking down, also, give the user a hit as to which part of the block literal is causing the problem, instead of the vague reference to the entire block literal. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65798 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGExpr.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'lib/CodeGen/CGExpr.cpp') diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index 7e8eff3847..5485e9eb1f 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -674,6 +674,17 @@ llvm::Value *CodeGenFunction::GetAddrOfBlockDecl(const BlockDeclRefExpr *E) { const llvm::Type *Ty; Ty = CGM.getTypes().ConvertType(E->getDecl()->getType()); + if (E->isByRef()) + ErrorUnsupported(E, "__block variable in block literal"); + else if (E->getType()->isBlockPointerType()) + ErrorUnsupported(E, "block pointer in block literal"); + else if (E->getDecl()->getAttr() || + getContext().isObjCNSObjectType(E->getType())) + ErrorUnsupported(E, "__attribute__((NSObject)) variable in block " + "literal"); + else if (getContext().isObjCObjectPointerType(E->getType())) + ErrorUnsupported(E, "Objective-C variable in block literal"); + // See if we have already allocated an offset for this variable. if (offset == 0) { // if not, allocate one now. -- cgit v1.2.3