aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGExprConstant.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-03-01 01:09:12 +0000
committerAnders Carlsson <andersca@mac.com>2009-03-01 01:09:12 +0000
commit4de9fce48e42cc7ec1345c0fd21b3dbc5b9114c8 (patch)
tree68a066a7e73557f3fcaeccc391e86b95da64fc4c /lib/CodeGen/CGExprConstant.cpp
parent6f877cd1743b12a09b4e5f32cc94552c19df7e42 (diff)
Do some blocks cleanup and simplification. Fix a crash, and add a test case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65746 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExprConstant.cpp')
-rw-r--r--lib/CodeGen/CGExprConstant.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/CodeGen/CGExprConstant.cpp b/lib/CodeGen/CGExprConstant.cpp
index 93bc53f7b8..565549c91f 100644
--- a/lib/CodeGen/CGExprConstant.cpp
+++ b/lib/CodeGen/CGExprConstant.cpp
@@ -450,9 +450,13 @@ public:
return CGM.GetAddrOfConstantCFString(S);
}
case Expr::BlockExprClass: {
- BlockExpr *B = cast<BlockExpr>(E);
- if (!B->hasBlockDeclRefExprs())
- return cast<llvm::Constant>(CGF->BuildBlockLiteralTmp(B));
+ std::string FunctionName;
+ if (CGF)
+ FunctionName = CGF->CurFn->getName();
+ else
+ FunctionName = "global";
+
+ return CGM.GetAddrOfGlobalBlock(cast<BlockExpr>(E), FunctionName.c_str());
}
}