diff options
| author | Ken Dyck <kd@kendyck.com> | 2011-03-22 00:24:31 +0000 |
|---|---|---|
| committer | Ken Dyck <kd@kendyck.com> | 2011-03-22 00:24:31 +0000 |
| commit | 664569965f34939d28e7f719b4a2cd94007fdbe5 (patch) | |
| tree | 5c690c99c7eae80621325670b426eddd4d5e5f2d /clang/lib/CodeGen/CGExprConstant.cpp | |
| parent | 9c057ee4401fb9680b0116b68b2272e45ba062c4 (diff) | |
| download | bcm5719-llvm-664569965f34939d28e7f719b4a2cd94007fdbe5.tar.gz bcm5719-llvm-664569965f34939d28e7f719b4a2cd94007fdbe5.zip | |
Eliminate some literal '8's in FillInNullDataMemberPointers() by switching
to CharUnits. No change in functionality intended.
llvm-svn: 128047
Diffstat (limited to 'clang/lib/CodeGen/CGExprConstant.cpp')
| -rw-r--r-- | clang/lib/CodeGen/CGExprConstant.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/clang/lib/CodeGen/CGExprConstant.cpp b/clang/lib/CodeGen/CGExprConstant.cpp index c5d4a658c6f..ce25dc7ac5b 100644 --- a/clang/lib/CodeGen/CGExprConstant.cpp +++ b/clang/lib/CodeGen/CGExprConstant.cpp @@ -1035,7 +1035,8 @@ static void FillInNullDataMemberPointers(CodeGenModule &CGM, QualType T, std::vector<llvm::Constant *> &Elements, uint64_t StartOffset) { - assert(StartOffset % 8 == 0 && "StartOffset not byte aligned!"); + assert(StartOffset % CGM.getContext().getCharWidth() == 0 && + "StartOffset not byte aligned!"); if (CGM.getTypes().isZeroInitializable(T)) return; @@ -1094,8 +1095,8 @@ FillInNullDataMemberPointers(CodeGenModule &CGM, QualType T, assert(!T->getAs<MemberPointerType>()->getPointeeType()->isFunctionType() && "Should only see pointers to data members here!"); - uint64_t StartIndex = StartOffset / 8; - uint64_t EndIndex = StartIndex + CGM.getContext().getTypeSize(T) / 8; + CharUnits StartIndex = CGM.getContext().toCharUnitsFromBits(StartOffset); + CharUnits EndIndex = StartIndex + CGM.getContext().getTypeSizeInChars(T); // FIXME: hardcodes Itanium member pointer representation! llvm::Constant *NegativeOne = @@ -1103,8 +1104,8 @@ FillInNullDataMemberPointers(CodeGenModule &CGM, QualType T, -1ULL, /*isSigned*/true); // Fill in the null data member pointer. - for (uint64_t I = StartIndex; I != EndIndex; ++I) - Elements[I] = NegativeOne; + for (CharUnits I = StartIndex; I != EndIndex; ++I) + Elements[I.getQuantity()] = NegativeOne; } } |

