From bbce49b9e5c6d7f05926b89f8e6fd235ae01c250 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Tue, 12 Aug 2008 00:12:39 +0000 Subject: Add ObjC constant string support for NeXT. Changed CGObjCRuntime::GenerateConstantString interface to take std::string instead of char* and size. Change ObjC functions which call on GenerateConstantString to bitcast result to appropriate type. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54659 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGExprConstant.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/CodeGen/CGExprConstant.cpp') 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) { -- cgit v1.2.3