Skip to content

Commit

Permalink
[NFC] Add missing invariant checks for ExtInfoBuilders.
Browse files Browse the repository at this point in the history
  • Loading branch information
varungandhi-apple committed Sep 7, 2020
1 parent 537017a commit e48469d
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions include/swift/AST/ExtInfo.h
Expand Up @@ -360,12 +360,16 @@ class ASTExtInfo {

ASTExtInfoBuilder builder;

// Only for use by ASTExtInfoBuilder::build. Don't use it elsewhere!
ASTExtInfo(ASTExtInfoBuilder builder) : builder(builder) {}

ASTExtInfo(unsigned bits, ClangTypeInfo clangTypeInfo)
: builder(bits, clangTypeInfo){};
: builder(bits, clangTypeInfo) {
builder.checkInvariants();
};

public:
ASTExtInfo() : builder(){};
ASTExtInfo() : builder() { builder.checkInvariants(); };

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

SILExtInfoBuilder builder;

// Only for use by SILExtInfoBuilder::build. Don't use it elsewhere!
SILExtInfo(SILExtInfoBuilder builder) : builder(builder) {}

SILExtInfo(unsigned bits, ClangTypeInfo clangTypeInfo)
: builder(bits, clangTypeInfo){};
: builder(bits, clangTypeInfo) {
builder.checkInvariants();
};

public:
SILExtInfo() : builder(){};
SILExtInfo() : builder() { builder.checkInvariants(); };

static SILExtInfo getThin() {
return SILExtInfoBuilder(SILExtInfoBuilder::Representation::Thin, false,
Expand Down

0 comments on commit e48469d

Please sign in to comment.