summaryrefslogtreecommitdiffstats
path: root/clang/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
commit1f78a9ad56d2bdbe9784703a8ea9dac8d41d80f3 (patch)
treeb2716d0ea0c4e7d12f021563ac158b2190f2ada2 /clang/lib/CodeGen/CGObjCMac.cpp
parent1d08fd9b7986dd2dd9969d5e40b2a329644e0e38 (diff)
downloadbcm5719-llvm-1f78a9ad56d2bdbe9784703a8ea9dac8d41d80f3.tar.gz
bcm5719-llvm-1f78a9ad56d2bdbe9784703a8ea9dac8d41d80f3.zip
Clean up of my last patch.
llvm-svn: 110290
Diffstat (limited to 'clang/lib/CodeGen/CGObjCMac.cpp')
-rw-r--r--clang/lib/CodeGen/CGObjCMac.cpp29
1 files changed, 16 insertions, 13 deletions
diff --git a/clang/lib/CodeGen/CGObjCMac.cpp b/clang/lib/CodeGen/CGObjCMac.cpp
index e7f81a2be89..0bfc94eaaf5 100644
--- a/clang/lib/CodeGen/CGObjCMac.cpp
+++ b/clang/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': ",
OpenPOWER on IntegriCloud