Skip to content

Commit 7e3de6c

Browse files
committed
Add an assert for matching record types
1 parent a719841 commit 7e3de6c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

clang/lib/CIR/CodeGen/CIRGenBuilder.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,12 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy {
111111
auto type =
112112
getType<cir::RecordType>(members, nameAttr, packed, padded, kind);
113113

114+
// If we found an existing type, verify that either it is incomplete or
115+
// it matches the requested attributes.
116+
assert(!type.isIncomplete() ||
117+
(type.getMembers() == members && type.getPacked() == packed &&
118+
type.getPadded() == padded));
119+
114120
// Complete an incomplete record or ensure the existing complete record
115121
// matches the requested attributes.
116122
type.complete(members, packed, padded);

0 commit comments

Comments
 (0)