diff options
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 8 | ||||
-rw-r--r-- | clang/test/CodeGenObjC/encode-test-4.m | 5 |
2 files changed, 7 insertions, 6 deletions
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); } diff --git a/clang/test/CodeGenObjC/encode-test-4.m b/clang/test/CodeGenObjC/encode-test-4.m new file mode 100644 index 00000000000..4d39a532d2e --- /dev/null +++ b/clang/test/CodeGenObjC/encode-test-4.m @@ -0,0 +1,5 @@ +// RUN: clang -emit-llvm -o - %s -O2 | grep "ret i32 1" + +int a() { + return @encode(int) == @encode(int); +} |