summaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGExpr.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/CGExpr.cpp
parent6393519272ce727f4d26e71bbefb5de712274d0e (diff)
downloadclang-31937a5f7cb689377ff39397f4d0a8cff22d7359.tar.gz
clang-31937a5f7cb689377ff39397f4d0a8cff22d7359.tar.bz2
clang-31937a5f7cb689377ff39397f4d0a8cff22d7359.tar.xz
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/CGExpr.cpp')
-rw-r--r--lib/CodeGen/CGExpr.cpp11
1 files changed, 11 insertions, 0 deletions
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<ObjCNSObjectAttr>() ||
+ 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.