aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGExprConstant.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CodeGen/CGExprConstant.cpp')
-rw-r--r--lib/CodeGen/CGExprConstant.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/CodeGen/CGExprConstant.cpp b/lib/CodeGen/CGExprConstant.cpp
index 5865f21522..3d530e8210 100644
--- a/lib/CodeGen/CGExprConstant.cpp
+++ b/lib/CodeGen/CGExprConstant.cpp
@@ -61,8 +61,10 @@ public:
return llvm::ConstantInt::get(ConvertType(E->getType()), E->getValue());
}
llvm::Constant *VisitObjCStringLiteral(const ObjCStringLiteral *E) {
- return CGM.getObjCRuntime().GenerateConstantString(
- E->getString()->getStrData(), E->getString()->getByteLength());
+ std::string S(E->getString()->getStrData(),
+ E->getString()->getByteLength());
+ llvm::Constant *C = CGM.getObjCRuntime().GenerateConstantString(S);
+ return llvm::ConstantExpr::getBitCast(C, ConvertType(E->getType()));
}
llvm::Constant *VisitCompoundLiteralExpr(CompoundLiteralExpr *E) {