aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGBlocks.cpp
diff options
context:
space:
mode:
authorMike Stump <mrs@apple.com>2009-03-02 03:04:42 +0000
committerMike Stump <mrs@apple.com>2009-03-02 03:04:42 +0000
commit31937a5f7cb689377ff39397f4d0a8cff22d7359 (patch)
tree1c5c6ce42b620c741923af887ca66e417b9fc6a2 /lib/CodeGen/CGBlocks.cpp
parent6393519272ce727f4d26e71bbefb5de712274d0e (diff)
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
Diffstat (limited to 'lib/CodeGen/CGBlocks.cpp')
-rw-r--r--lib/CodeGen/CGBlocks.cpp39
1 files changed, 0 insertions, 39 deletions
diff --git a/lib/CodeGen/CGBlocks.cpp b/lib/CodeGen/CGBlocks.cpp
index a26c0709e3..e50b320a0c 100644
--- a/lib/CodeGen/CGBlocks.cpp
+++ b/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<ObjCNSObjectAttr>() ||
- 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<llvm::Constant*> Elts;
llvm::Constant *C;
llvm::Value *V;