diff options
author | Chris Lattner <sabre@nondot.org> | 2008-06-21 21:44:18 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-06-21 21:44:18 +0000 |
commit | 13fd7e5111032f54b538dd66d035b0ccc1f82467 (patch) | |
tree | 8ba9554dc5025c65798210a2b8750c9f14d382bb /lib/CodeGen/CGExprConstant.cpp | |
parent | 23a0e45540cf441eeaaba02da5cf0419f936c6a0 (diff) |
"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
Diffstat (limited to 'lib/CodeGen/CGExprConstant.cpp')
-rw-r--r-- | lib/CodeGen/CGExprConstant.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
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()); |