Skip to content

Commit 529a8a3

Browse files
committed
Partial revert of calculating the full struct size directly.
1 parent c0572e8 commit 529a8a3

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

clang/lib/CodeGen/CGBuiltin.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,14 +1156,12 @@ static std::pair<uint64_t, uint64_t> getSubobjectInfo(CodeGenFunction &CGF,
11561156

11571157
if (const auto *DRE = dyn_cast<DeclRefExpr>(Subobject)) {
11581158
// We're pointing to the beginning of the struct.
1159-
QualType Ty = DRE->getDecl()->getType();
1159+
VD = DRE->getDecl();
1160+
QualType Ty = VD->getType();
11601161
if (Ty->isPointerType())
11611162
Ty = Ty->getPointeeType();
1162-
ASTContext &Ctx = CGF.getContext();
1163-
return std::make_pair(Ctx.toCharUnitsFromBits(Ctx.getTypeSize(Ty)).getQuantity(), 0);
1164-
}
1165-
1166-
if (const auto *ME = dyn_cast<MemberExpr>(Subobject)) {
1163+
OuterRD = Ty->getAsRecordDecl();
1164+
} else if (const auto *ME = dyn_cast<MemberExpr>(Subobject)) {
11671165
VD = ME->getMemberDecl();
11681166
OuterRD = VD->getDeclContext()->getOuterLexicalRecordContext();
11691167
} else {

0 commit comments

Comments
 (0)