diff options
author | Ken Dyck <kd@kendyck.com> | 2011-04-24 10:04:59 +0000 |
---|---|---|
committer | Ken Dyck <kd@kendyck.com> | 2011-04-24 10:04:59 +0000 |
commit | 28ebde58dd94b5ed2a6d149251202ab2c602a4a6 (patch) | |
tree | 78f74c1f8e7f1918dd84f880f98c121830c2c2f9 /lib/CodeGen/CGRecordLayoutBuilder.cpp | |
parent | c0a455942453a37dd7db83eb354f40a49872ab06 (diff) |
Convert CGBitFieldInfo::FieldByteOffset to CharUnits. No change in
functionality intended.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130085 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGRecordLayoutBuilder.cpp')
-rw-r--r-- | lib/CodeGen/CGRecordLayoutBuilder.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/CodeGen/CGRecordLayoutBuilder.cpp b/lib/CodeGen/CGRecordLayoutBuilder.cpp index 5a8115639d..7f52e31068 100644 --- a/lib/CodeGen/CGRecordLayoutBuilder.cpp +++ b/lib/CodeGen/CGRecordLayoutBuilder.cpp @@ -309,9 +309,10 @@ CGBitFieldInfo CGBitFieldInfo::MakeInfo(CodeGenTypes &Types, // in higher bits. But this also reverts the bytes, so fix this here by reverting // the byte offset on big-endian machines. if (Types.getTargetData().isBigEndian()) { - AI.FieldByteOffset = (ContainingTypeSizeInBits - AccessStart - AccessWidth )/8; + AI.FieldByteOffset = Types.getContext().toCharUnitsFromBits( + ContainingTypeSizeInBits - AccessStart - AccessWidth); } else { - AI.FieldByteOffset = AccessStart / 8; + AI.FieldByteOffset = Types.getContext().toCharUnitsFromBits(AccessStart); } AI.FieldBitStart = AccessBitsInFieldStart - AccessStart; AI.AccessWidth = AccessWidth; @@ -978,7 +979,7 @@ CGRecordLayout *CodeGenTypes::ComputeRecordLayout(const RecordDecl *D) { // Verify that every component access is within the structure. uint64_t FieldOffset = SL->getElementOffsetInBits(AI.FieldIndex); uint64_t AccessBitOffset = FieldOffset + - getContext().toBits(CharUnits::fromQuantity(AI.FieldByteOffset)); + getContext().toBits(AI.FieldByteOffset); assert(AccessBitOffset + AI.AccessWidth <= TypeSizeInBits && "Invalid bit-field access (out of range)!"); } @@ -1037,7 +1038,7 @@ void CGBitFieldInfo::print(llvm::raw_ostream &OS) const { OS.indent(8); OS << "<AccessInfo" << " FieldIndex:" << AI.FieldIndex - << " FieldByteOffset:" << AI.FieldByteOffset + << " FieldByteOffset:" << AI.FieldByteOffset.getQuantity() << " FieldBitStart:" << AI.FieldBitStart << " AccessWidth:" << AI.AccessWidth << "\n"; OS.indent(8 + strlen("<AccessInfo")); |