[cfe-commits] r128047 - /cfe/trunk/lib/CodeGen/CGExprConstant.cpp
Ken Dyck
kd at kendyck.com
Mon Mar 21 17:24:31 PDT 2011
Author: kjdyck
Date: Mon Mar 21 19:24:31 2011
New Revision: 128047
URL: http://llvm.org/viewvc/llvm-project?rev=128047&view=rev
Log:
Eliminate some literal '8's in FillInNullDataMemberPointers() by switching
to CharUnits. No change in functionality intended.
Modified:
cfe/trunk/lib/CodeGen/CGExprConstant.cpp
Modified: cfe/trunk/lib/CodeGen/CGExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprConstant.cpp?rev=128047&r1=128046&r2=128047&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprConstant.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprConstant.cpp Mon Mar 21 19:24:31 2011
@@ -1035,7 +1035,8 @@
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 @@
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 @@
-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;
}
}
More information about the cfe-commits
mailing list