From 8b8683f9f6051c6854f6e9a044d3d882649f72fd 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. llvm-svn: 54659 --- clang/lib/CodeGen/CGExprConstant.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'clang/lib/CodeGen/CGExprConstant.cpp') diff --git a/clang/lib/CodeGen/CGExprConstant.cpp b/clang/lib/CodeGen/CGExprConstant.cpp index 5865f215223..3d530e8210f 100644 --- a/clang/lib/CodeGen/CGExprConstant.cpp +++ b/clang/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