summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2011-05-17 22:46:11 +0000
committerFariborz Jahanian <fjahanian@apple.com>2011-05-17 22:46:11 +0000
commitccdfa39005c372b906174fd821628b4378c355b7 (patch)
tree8f18931f3ab5124e2bc0d75d3fa191f574da9d41 /clang/lib/CodeGen/CodeGenModule.cpp
parent17e5c4e26184121e5871af3f6f34a86b0ec75657 (diff)
downloadbcm5719-llvm-ccdfa39005c372b906174fd821628b4378c355b7.tar.gz
bcm5719-llvm-ccdfa39005c372b906174fd821628b4378c355b7.zip
Code cleanup of my last patch.
llvm-svn: 131499
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp21
1 files changed, 8 insertions, 13 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 7f2e3f593ef..4f2b10ad652 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -1770,25 +1770,20 @@ CodeGenModule::GetAddrOfConstantString(const StringLiteral *Literal) {
const llvm::Type *Ty = getTypes().ConvertType(getContext().IntTy);
llvm::Constant *GV;
if (Features.ObjCNonFragileABI) {
- std::string str;
- if (StringClass.empty())
- str = "OBJC_CLASS_$_NSConstantString";
- else {
- str = "OBJC_CLASS_$_" + StringClass;
- }
+ std::string str =
+ StringClass.empty() ? "OBJC_CLASS_$_NSConstantString"
+ : "OBJC_CLASS_$_" + StringClass;
GV = getObjCRuntime().GetClassGlobal(str);
// Make sure the result is of the correct type.
const llvm::Type *PTy = llvm::PointerType::getUnqual(Ty);
ConstantStringClassRef =
llvm::ConstantExpr::getBitCast(GV, PTy);
} else {
- Ty = llvm::ArrayType::get(Ty, 0);
- if (StringClass.empty())
- GV = CreateRuntimeVariable(Ty, "_NSConstantStringClassReference");
- else {
- std::string str = "_" + StringClass + "ClassReference";
- GV = CreateRuntimeVariable(Ty, str);
- }
+ std::string str =
+ StringClass.empty() ? "_NSConstantStringClassReference"
+ : "_" + StringClass + "ClassReference";
+ const llvm::Type *PTy = llvm::ArrayType::get(Ty, 0);
+ GV = CreateRuntimeVariable(PTy, str);
// Decay array -> ptr
ConstantStringClassRef =
llvm::ConstantExpr::getGetElementPtr(GV, Zeros, 2);
OpenPOWER on IntegriCloud