Skip to content

Commit e48469d

Browse files
[NFC] Add missing invariant checks for ExtInfoBuilders.
1 parent 537017a commit e48469d

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

include/swift/AST/ExtInfo.h

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -360,12 +360,16 @@ class ASTExtInfo {
360360

361361
ASTExtInfoBuilder builder;
362362

363+
// Only for use by ASTExtInfoBuilder::build. Don't use it elsewhere!
363364
ASTExtInfo(ASTExtInfoBuilder builder) : builder(builder) {}
365+
364366
ASTExtInfo(unsigned bits, ClangTypeInfo clangTypeInfo)
365-
: builder(bits, clangTypeInfo){};
367+
: builder(bits, clangTypeInfo) {
368+
builder.checkInvariants();
369+
};
366370

367371
public:
368-
ASTExtInfo() : builder(){};
372+
ASTExtInfo() : builder() { builder.checkInvariants(); };
369373

370374
/// Create a builder with the same state as \c this.
371375
ASTExtInfoBuilder intoBuilder() const { return builder; }
@@ -654,12 +658,16 @@ class SILExtInfo {
654658

655659
SILExtInfoBuilder builder;
656660

661+
// Only for use by SILExtInfoBuilder::build. Don't use it elsewhere!
657662
SILExtInfo(SILExtInfoBuilder builder) : builder(builder) {}
663+
658664
SILExtInfo(unsigned bits, ClangTypeInfo clangTypeInfo)
659-
: builder(bits, clangTypeInfo){};
665+
: builder(bits, clangTypeInfo) {
666+
builder.checkInvariants();
667+
};
660668

661669
public:
662-
SILExtInfo() : builder(){};
670+
SILExtInfo() : builder() { builder.checkInvariants(); };
663671

664672
static SILExtInfo getThin() {
665673
return SILExtInfoBuilder(SILExtInfoBuilder::Representation::Thin, false,

0 commit comments

Comments
 (0)