Skip to content

Commit 79f92df

Browse files
committed
Add helpful note.
1 parent 1ad2825 commit 79f92df

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

clang/lib/CodeGen/CGBuiltin.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1135,8 +1135,11 @@ static bool GetFieldOffset(ASTContext &Ctx, const RecordDecl *RD,
11351135
if (RD->isImplicit())
11361136
return false;
11371137

1138-
const ASTRecordLayout &Layout = Ctx.getASTRecordLayout(RD);
1138+
// Keep track of the field number ourselves, because the other methods
1139+
// (CGRecordLayout::getLLVMFieldNo) aren't always equivalent to how the AST
1140+
// is laid out.
11391141
uint32_t FieldNo = 0;
1142+
const ASTRecordLayout &Layout = Ctx.getASTRecordLayout(RD);
11401143

11411144
for (const FieldDecl *Field : RD->fields()) {
11421145
if (Field == FD) {

0 commit comments

Comments
 (0)