From 13fd7e5111032f54b538dd66d035b0ccc1f82467 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 21 Jun 2008 21:44:18 +0000 Subject: "this patch adds code generation hooks for Objective-C constant strings. It also modifies Sema so that Objective-C constant strings are treated as untyped objects if the interface for the constant string class can not be found. This is consistent with Apple GCC. I thought it was consistent with GNU GCC, since this was causing failures when trying to compile GNUstep with (GNU) GCC, but it appears that this is not the case when attempting to produce a simple test case to demonstrate it. Possibly there is a way of making the error go away, but I haven't found out what it is yet." Patch by David Chisnall! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52599 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGExprConstant.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/CodeGen/CGExprConstant.cpp') diff --git a/lib/CodeGen/CGExprConstant.cpp b/lib/CodeGen/CGExprConstant.cpp index cae1f4bb24..fe11a5fb0a 100644 --- a/lib/CodeGen/CGExprConstant.cpp +++ b/lib/CodeGen/CGExprConstant.cpp @@ -59,6 +59,10 @@ public: llvm::Constant *VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *E) { 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()); + } llvm::Constant *VisitCompoundLiteralExpr(CompoundLiteralExpr *E) { return Visit(E->getInitializer()); -- cgit v1.2.3