mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 09:06:21 +01:00
Fixing assertion failure introduced in 196602.
Also includes a minor refactor with no functional change. llvm-svn: 196627
This commit is contained in:
@@ -283,8 +283,7 @@ public:
|
||||
}
|
||||
|
||||
bool hasZeroSizedSubObject() const {
|
||||
assert(CXXInfo && "Record layout does not have C++ specific info!");
|
||||
return CXXInfo->HasZeroSizedSubObject;
|
||||
return CXXInfo && CXXInfo->HasZeroSizedSubObject;
|
||||
}
|
||||
|
||||
bool leadsWithZeroSizedBase() const {
|
||||
|
||||
@@ -2590,15 +2590,13 @@ void MicrosoftRecordLayoutBuilder::layoutVirtualBase(const CXXRecordDecl *RD,
|
||||
// vtordisps are always 4 bytes (even in 64-bit mode)
|
||||
if (HasVtordisp)
|
||||
Size = Size.RoundUpToAlignment(Alignment) + CharUnits::fromQuantity(4);
|
||||
Size = Size.RoundUpToAlignment(BaseAlign);
|
||||
|
||||
// Insert the base here.
|
||||
CharUnits BaseOffset = Size.RoundUpToAlignment(BaseAlign);
|
||||
Size = Size.RoundUpToAlignment(BaseAlign);
|
||||
VBases.insert(
|
||||
std::make_pair(RD, ASTRecordLayout::VBaseInfo(BaseOffset, HasVtordisp)));
|
||||
Size = BaseOffset + BaseNVSize;
|
||||
// Note: we don't update alignment here because it was accounted for in
|
||||
// InitializeLayout.
|
||||
std::make_pair(RD, ASTRecordLayout::VBaseInfo(Size, HasVtordisp)));
|
||||
Size += BaseNVSize;
|
||||
// Alignment was upadated in InitializeCXXLayout.
|
||||
|
||||
PreviousBaseLayout = &Layout;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user