diff options
author | Mike Stump <mrs@apple.com> | 2009-02-19 22:01:56 +0000 |
---|---|---|
committer | Mike Stump <mrs@apple.com> | 2009-02-19 22:01:56 +0000 |
commit | b83d287bc7f47d36fb0751a481e2ef9308b37252 (patch) | |
tree | ed7d31e8981c0c922eaf3eb653f0573182275658 /lib/CodeGen/CGExprConstant.cpp | |
parent | f084663ed01cbe382c700947908b4130fec0406a (diff) |
Add enough checking to ensure that non-constant block literals don't
appear to be constant. I'll probably redo this and throw it all away
later once we have codegen for BlockDeclRefExprs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65070 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExprConstant.cpp')
-rw-r--r-- | lib/CodeGen/CGExprConstant.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/CodeGen/CGExprConstant.cpp b/lib/CodeGen/CGExprConstant.cpp index 523014f1fb..8cfd60ce5c 100644 --- a/lib/CodeGen/CGExprConstant.cpp +++ b/lib/CodeGen/CGExprConstant.cpp @@ -382,6 +382,8 @@ public: } llvm::Constant *VisitBlockExpr(const BlockExpr *E) { + assert (!E->hasBlockDeclRefExprs() && "global block with BlockDeclRefs"); + const char *Name = ""; if (const NamedDecl *ND = dyn_cast<NamedDecl>(CGF->CurFuncDecl)) Name = ND->getNameAsString().c_str(); @@ -615,7 +617,9 @@ public: return CGM.GetAddrOfConstantCFString(S); } case Expr::BlockExprClass: { - return CGF->BuildBlockLiteralTmp(cast<BlockExpr>(E)); + BlockExpr *B = cast<BlockExpr>(E); + if (!B->hasBlockDeclRefExprs()) + return CGF->BuildBlockLiteralTmp(B); } } |