Skip to content

Commit c2d3f39

Browse files
author
Théo De Magalhaes
committed
fix: do not consider the 1 byte of an empty struct as padding
1 parent d9ed270 commit c2d3f39

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

clang/lib/AST/RecordLayoutBuilder.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3262,9 +3262,9 @@ void MicrosoftRecordLayoutBuilder::finalizeLayout(const RecordDecl *RD) {
32623262
return;
32633263
}
32643264
unsigned CharBitNum = Context.getTargetInfo().getCharWidth();
3265-
uint64_t SizeInBits = Context.toBits(Size);
3266-
if (SizeInBits > UnpaddedSizeInBits) {
3267-
unsigned int PadSize = SizeInBits - UnpaddedSizeInBits;
3265+
uint64_t DataSizeInBits = Context.toBits(DataSize);
3266+
if (DataSizeInBits > UnpaddedSizeInBits) {
3267+
unsigned int PadSize = DataSizeInBits - UnpaddedSizeInBits;
32683268
bool InBits = true;
32693269
if (PadSize % CharBitNum == 0) {
32703270
PadSize = PadSize / CharBitNum;

0 commit comments

Comments
 (0)