summaryrefslogtreecommitdiffstats
path: root/clang/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
commit0e425b820008f61e0c129f81df523a4d525a99dc (patch)
treedbc92c644dc75ddda7b29ec2e28188b7d34de222 /clang/lib/CodeGen/CGExpr.cpp
parentd1094e032f50fa6e43beb2ea9871ac92b76f689d (diff)
downloadbcm5719-llvm-0e425b820008f61e0c129f81df523a4d525a99dc.tar.gz
bcm5719-llvm-0e425b820008f61e0c129f81df523a4d525a99dc.zip
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
Diffstat (limited to 'clang/lib/CodeGen/CGExpr.cpp')
-rw-r--r--clang/lib/CodeGen/CGExpr.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index 7e8eff3847d..5485e9eb1f6 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/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.
OpenPOWER on IntegriCloud