From 0e425b820008f61e0c129f81df523a4d525a99dc 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. llvm-svn: 65798 --- clang/lib/CodeGen/CGBlocks.cpp | 39 --------------------------------------- 1 file changed, 39 deletions(-) (limited to 'clang/lib/CodeGen/CGBlocks.cpp') diff --git a/clang/lib/CodeGen/CGBlocks.cpp b/clang/lib/CodeGen/CGBlocks.cpp index a26c0709e39..e50b320a0cd 100644 --- a/clang/lib/CodeGen/CGBlocks.cpp +++ b/clang/lib/CodeGen/CGBlocks.cpp @@ -132,42 +132,6 @@ static bool CanBlockBeGlobal(const CodeGenFunction::BlockInfo &Info) return Info.ByRefDeclRefs.empty() && Info.ByCopyDeclRefs.empty(); } -/// CanGenerateCodeForBlockExpr - Returns whether CodeGen for the block expr -/// is supported. Will emit a diagnostic and return false if not. -/// FIXME: Once we support everything this should of course be removed. -static bool CanGenerateCodeForBlockExpr(CodeGenFunction &CGF, - const BlockExpr* BE, - const CodeGenFunction::BlockInfo &Info) -{ - if (!Info.ByRefDeclRefs.empty()) { - CGF.ErrorUnsupported(BE, "block expression with __block variables"); - return false; - } - - for (size_t I = 0, E = Info.ByCopyDeclRefs.size(); I != E; ++I) { - const BlockDeclRefExpr *E = Info.ByCopyDeclRefs[I]; - - if (E->getType()->isBlockPointerType()) { - CGF.ErrorUnsupported(BE, "block expression with imported block"); - return false; - } - - if (E->getDecl()->getAttr() || - CGF.getContext().isObjCNSObjectType(E->getType())) { - CGF.ErrorUnsupported(BE, "block expression with __attribute__((NSObject))" - " variable"); - return false; - } - - if (CGF.getContext().isObjCObjectPointerType(E->getType())) { - CGF.ErrorUnsupported(BE, "block expression with Objective-C variable"); - return false; - } - } - - return true; -} - // FIXME: Push most into CGM, passing down a few bits, like current // function name. llvm::Value *CodeGenFunction::BuildBlockLiteralTmp(const BlockExpr *BE) { @@ -180,9 +144,6 @@ llvm::Value *CodeGenFunction::BuildBlockLiteralTmp(const BlockExpr *BE) { if (CanBlockBeGlobal(Info)) return CGM.GetAddrOfGlobalBlock(BE, Name.c_str()); - if (!CanGenerateCodeForBlockExpr(*this, BE, Info)) - return llvm::UndefValue::get(ConvertType(BE->getType())); - std::vector Elts; llvm::Constant *C; llvm::Value *V; -- cgit v1.2.3