aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGObjCGNU.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
commitbbce49b9e5c6d7f05926b89f8e6fd235ae01c250 (patch)
tree2dd0d36452f0099a0c8688016e88044f102755e9 /lib/CodeGen/CGObjCGNU.cpp
parent0d8a13d823b644d94ae5f8db275be3592b9bbbfc (diff)
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
Diffstat (limited to 'lib/CodeGen/CGObjCGNU.cpp')
-rw-r--r--lib/CodeGen/CGObjCGNU.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/CodeGen/CGObjCGNU.cpp b/lib/CodeGen/CGObjCGNU.cpp
index d77ae05939..ab896cc675 100644
--- a/lib/CodeGen/CGObjCGNU.cpp
+++ b/lib/CodeGen/CGObjCGNU.cpp
@@ -90,8 +90,7 @@ private:
std::vector<llvm::Constant*> &V, const std::string &Name="");
public:
CGObjCGNU(CodeGen::CodeGenModule &cgm);
- virtual llvm::Constant *GenerateConstantString(const char *String,
- const size_t length);
+ virtual llvm::Constant *GenerateConstantString(const std::string &String);
virtual llvm::Value *GenerateMessageSend(llvm::IRBuilder<> &Builder,
const llvm::Type *ReturnTy,
llvm::Value *Sender,
@@ -248,13 +247,11 @@ llvm::Constant *CGObjCGNU::MakeGlobal(const llvm::ArrayType *Ty,
//TODO: In case there are any crazy people still using the GNU runtime without
//an OpenStep implementation, this should let them select their own class for
//constant strings.
-llvm::Constant *CGObjCGNU::GenerateConstantString(const char *String, const
- size_t length) {
- std::string Str(String, String +length);
+llvm::Constant *CGObjCGNU::GenerateConstantString(const std::string &Str) {
std::vector<llvm::Constant*> Ivars;
Ivars.push_back(NULLPtr);
Ivars.push_back(MakeConstantString(Str));
- Ivars.push_back(llvm::ConstantInt::get(IntTy, length));
+ Ivars.push_back(llvm::ConstantInt::get(IntTy, Str.size()));
llvm::Constant *ObjCStr = MakeGlobal(
llvm::StructType::get(PtrToInt8Ty, PtrToInt8Ty, IntTy, NULL),
Ivars, ".objc_str");