aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGObjCMac.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2010-08-05 00:19:48 +0000
committerFariborz Jahanian <fjahanian@apple.com>2010-08-05 00:19:48 +0000
commitb8fd2eb42a9f21c1ea65a5be37f3ce814c5cf745 (patch)
treeb7655f8f9863c51e8e2c133a927eee720538fd6f /lib/CodeGen/CGObjCMac.cpp
parent4019c4f692e7b8b2d7a7b6a377c78337596052e4 (diff)
Clean up of my last patch.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110290 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGObjCMac.cpp')
-rw-r--r--lib/CodeGen/CGObjCMac.cpp29
1 files changed, 16 insertions, 13 deletions
diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp
index e7f81a2be8..0bfc94eaaf 100644
--- a/lib/CodeGen/CGObjCMac.cpp
+++ b/lib/CodeGen/CGObjCMac.cpp
@@ -943,8 +943,7 @@ protected:
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 @@ llvm::Constant *CGObjCCommonMac::GCBlockLayout(CodeGen::CodeGenFunction &CGF,
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 @@ void CGObjCCommonMac::BuildAggrIvarLayout(const ObjCImplementationDecl *OI,
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 @@ llvm::Constant *CGObjCCommonMac::BuildIvarLayout(
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': ",