]> granicus.if.org Git - clang/commitdiff
Code cleanup of my last patch.
authorFariborz Jahanian <fjahanian@apple.com>
Tue, 17 May 2011 22:46:11 +0000 (22:46 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Tue, 17 May 2011 22:46:11 +0000 (22:46 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131499 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CodeGenModule.cpp

index 7f2e3f593ef044a71ceb05f115a1ab7278a6f5a0..4f2b10ad652b8327b905dfe35a10ced5bc47bb7c 100644 (file)
@@ -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);