r249085 - Don't adjust field offsets when using external record layout.
Zachary Turner via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 1 15:08:02 PDT 2015
Author: zturner
Date: Thu Oct 1 17:08:02 2015
New Revision: 249085
URL: http://llvm.org/viewvc/llvm-project?rev=249085&view=rev
Log:
Don't adjust field offsets when using external record layout.
This was already being done when injecting the VBPtr, but not
when injecting the VFPtr. This fixes a number of tests in LLDB's
test suite.
Reviewed by: David Majnemer
Differential Revision: http://reviews.llvm.org/D13276
Modified:
cfe/trunk/lib/AST/RecordLayoutBuilder.cpp
Modified: cfe/trunk/lib/AST/RecordLayoutBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/RecordLayoutBuilder.cpp?rev=249085&r1=249084&r2=249085&view=diff
==============================================================================
--- cfe/trunk/lib/AST/RecordLayoutBuilder.cpp (original)
+++ cfe/trunk/lib/AST/RecordLayoutBuilder.cpp Thu Oct 1 17:08:02 2015
@@ -2667,13 +2667,20 @@ void MicrosoftRecordLayoutBuilder::injec
// alignment.
CharUnits Offset = PointerInfo.Size.RoundUpToAlignment(
std::max(RequiredAlignment, Alignment));
- // Increase the size of the object and push back all fields, the vbptr and all
- // bases by the offset amount.
+ // Push back the vbptr, but increase the size of the object and push back
+ // regular fields by the offset only if not using external record layout.
+ if (HasVBPtr)
+ VBPtrOffset += Offset;
+
+ if (UseExternalLayout)
+ return;
+
Size += Offset;
+
+ // If we're using an external layout, the fields offsets have already
+ // accounted for this adjustment.
for (uint64_t &FieldOffset : FieldOffsets)
FieldOffset += Context.toBits(Offset);
- if (HasVBPtr)
- VBPtrOffset += Offset;
for (BaseOffsetsMapTy::value_type &Base : Bases)
Base.second += Offset;
}
More information about the cfe-commits
mailing list