From e48469d03c87f8c1b87a2462fa3cd8c27c4d685f Mon Sep 17 00:00:00 2001 From: Varun Gandhi Date: Mon, 31 Aug 2020 17:03:08 -0700 Subject: [PATCH] [NFC] Add missing invariant checks for ExtInfoBuilders. --- include/swift/AST/ExtInfo.h | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/include/swift/AST/ExtInfo.h b/include/swift/AST/ExtInfo.h index 6f258723fb887..b0bbb20cdefc9 100644 --- a/include/swift/AST/ExtInfo.h +++ b/include/swift/AST/ExtInfo.h @@ -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; } @@ -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,