[cfe-commits] r131499 - /cfe/trunk/lib/CodeGen/CodeGenModule.cpp

Fariborz Jahanian fjahanian at apple.com
Tue May 17 15:46:12 PDT 2011


Author: fjahanian
Date: Tue May 17 17:46:11 2011
New Revision: 131499

URL: http://llvm.org/viewvc/llvm-project?rev=131499&view=rev
Log:
Code cleanup of my last patch.

Modified:
    cfe/trunk/lib/CodeGen/CodeGenModule.cpp

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=131499&r1=131498&r2=131499&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Tue May 17 17:46:11 2011
@@ -1770,25 +1770,20 @@
     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);





More information about the cfe-commits mailing list