[cfe-commits] r110290 - /cfe/trunk/lib/CodeGen/CGObjCMac.cpp

Fariborz Jahanian fjahanian at apple.com
Wed Aug 4 17:19:48 PDT 2010


Author: fjahanian
Date: Wed Aug  4 19:19:48 2010
New Revision: 110290

URL: http://llvm.org/viewvc/llvm-project?rev=110290&view=rev
Log:
Clean up of my last patch.

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

Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=110290&r1=110289&r2=110290&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Wed Aug  4 19:19:48 2010
@@ -943,8 +943,7 @@
   llvm::Constant *BuildIvarLayout(const ObjCImplementationDecl *OI,
                                   bool ForStrongLayout);
   
-  llvm::Constant *BuildIvarLayoutBitmap(bool hasUnion,
-                                        std::string &BitMap);
+  llvm::Constant *BuildIvarLayoutBitmap(std::string &BitMap);
 
   void BuildAggrIvarRecordLayout(const RecordType *RT,
                                  unsigned int BytePos, bool ForStrongLayout,
@@ -1747,7 +1746,7 @@
     return NullPtr;
   
   std::string BitMap;
-  llvm::Constant *C = BuildIvarLayoutBitmap(false, BitMap);
+  llvm::Constant *C = BuildIvarLayoutBitmap(BitMap);
   if (CGM.getLangOptions().ObjCGCBitmapPrint) {
     printf("\n block variable layout for block: ");
     const unsigned char *s = (unsigned char*)BitMap.c_str();
@@ -3728,18 +3727,15 @@
                                 MaxSkippedUnionIvarSize));
 }
 
-llvm::Constant *CGObjCCommonMac::BuildIvarLayoutBitmap(bool hasUnion,
-                                                       std::string& BitMap) {
+/// BuildIvarLayoutBitmap - This routine is the horsework for doing all
+/// the computations and returning the layout bitmap (for ivar or blocks) in
+/// the given argument BitMap string container. Routine reads
+/// two containers, IvarsInfo and SkipIvars which are assumed to be
+/// filled already by the caller.
+llvm::Constant *CGObjCCommonMac::BuildIvarLayoutBitmap(std::string& BitMap) {
   unsigned int WordsToScan, WordsToSkip;
   const llvm::Type *PtrTy = llvm::Type::getInt8PtrTy(VMContext);
   
-  // Sort on byte position in case we encounterred a union nested in
-  // the ivar list.
-  if (hasUnion && !IvarsInfo.empty())
-    std::sort(IvarsInfo.begin(), IvarsInfo.end());
-  if (hasUnion && !SkipIvars.empty())
-    std::sort(SkipIvars.begin(), SkipIvars.end());
-  
   // Build the string of skip/scan nibbles
   llvm::SmallVector<SKIP_SCAN, 32> SkipScanIvars;
   unsigned int WordSize =
@@ -3903,8 +3899,15 @@
   BuildAggrIvarLayout(OMD, 0, 0, RecFields, 0, ForStrongLayout, hasUnion);
   if (IvarsInfo.empty())
     return llvm::Constant::getNullValue(PtrTy);
+  // Sort on byte position in case we encounterred a union nested in
+  // the ivar list.
+  if (hasUnion && !IvarsInfo.empty())
+    std::sort(IvarsInfo.begin(), IvarsInfo.end());
+  if (hasUnion && !SkipIvars.empty())
+    std::sort(SkipIvars.begin(), SkipIvars.end());
+  
   std::string BitMap;
-  llvm::Constant *C = BuildIvarLayoutBitmap(hasUnion, BitMap);
+  llvm::Constant *C = BuildIvarLayoutBitmap(BitMap);
   
    if (CGM.getLangOptions().ObjCGCBitmapPrint) {
     printf("\n%s ivar layout for class '%s': ",





More information about the cfe-commits mailing list