Convert CGBitFieldInfo::FieldByteOffset to CharUnits. No change in
functionality intended.
llvm-svn: 130085
diff --git a/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp b/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp
index 5a81156..7f52e31 100644
--- a/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp
+++ b/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp
@@ -309,9 +309,10 @@
// 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 @@
// 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 @@
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"));