summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGExprConstant.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2008-08-12 00:12:39 +0000
committerDaniel Dunbar <daniel@zuster.org>2008-08-12 00:12:39 +0000
commit8b8683f9f6051c6854f6e9a044d3d882649f72fd (patch)
treecd0b5fce4755b89c27c8dc7d13a93cb974ed3e08 /clang/lib/CodeGen/CGExprConstant.cpp
parentdafdbf77b315961fedc959e9ea732fa3f5cbee67 (diff)
downloadbcm5719-llvm-8b8683f9f6051c6854f6e9a044d3d882649f72fd.tar.gz
bcm5719-llvm-8b8683f9f6051c6854f6e9a044d3d882649f72fd.zip
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
Diffstat (limited to 'clang/lib/CodeGen/CGExprConstant.cpp')
-rw-r--r--clang/lib/CodeGen/CGExprConstant.cpp6
1 files changed, 4 insertions, 2 deletions
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) {
OpenPOWER on IntegriCloud