From 4663a3368d5f562e788573bef6e3a78c46e8d1de Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Sat, 7 Mar 2009 20:17:55 +0000 Subject: Make constant emission for @encode use the common string emission code. This is a bit cleaner, and also "fixes" bad code that compares the addresses of the string constants. llvm-svn: 66346 --- clang/lib/CodeGen/CodeGenModule.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 95d881bc49a..16ba94791fa 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -1132,12 +1132,8 @@ llvm::Constant * CodeGenModule::GetAddrOfConstantStringFromObjCEncode(const ObjCEncodeExpr *E) { std::string Str; getContext().getObjCEncodingForType(E->getEncodedType(), Str); - - llvm::Constant *C = llvm::ConstantArray::get(Str); - C = new llvm::GlobalVariable(C->getType(), true, - llvm::GlobalValue::InternalLinkage, - C, ".str", &getModule()); - return C; + + return GetAddrOfConstantCString(Str); } -- cgit v1.2.3