@@ -451,14 +451,7 @@ class alignas(1 << DeclAlignInBits) Decl {
451451 // / Whether we have computed the above.
452452 IsTransparentComputed : 1 );
453453
454- SWIFT_INLINE_BITFIELD (ConstructorDecl, AbstractFunctionDecl, 3 +1 +1 ,
455- // / The body initialization kind (+1), or zero if not yet computed.
456- // /
457- // / This value is cached but is not serialized, because it is a property
458- // / of the definition of the constructor that is useful only to semantic
459- // / analysis and SIL generation.
460- ComputedBodyInitKind : 3 ,
461-
454+ SWIFT_INLINE_BITFIELD (ConstructorDecl, AbstractFunctionDecl, 1 +1 ,
462455 // / Whether this constructor can fail, by building an Optional type.
463456 Failable : 1 ,
464457
@@ -6770,6 +6763,37 @@ enum class CtorInitializerKind {
67706763 Factory
67716764};
67726765
6766+ // / Specifies the kind of initialization call performed within the body
6767+ // / of the constructor, e.g., self.init or super.init.
6768+ enum class BodyInitKind {
6769+ // / There are no calls to self.init or super.init.
6770+ None,
6771+ // / There is a call to self.init, which delegates to another (peer)
6772+ // / initializer.
6773+ Delegating,
6774+ // / There is a call to super.init, which chains to a superclass initializer.
6775+ Chained,
6776+ // / There are no calls to self.init or super.init explicitly in the body of
6777+ // / the constructor, but a 'super.init' call will be implicitly added
6778+ // / by semantic analysis.
6779+ ImplicitChained
6780+ };
6781+
6782+ struct BodyInitKindAndExpr {
6783+ BodyInitKind initKind;
6784+ ApplyExpr *initExpr;
6785+
6786+ BodyInitKindAndExpr () : initKind(BodyInitKind::None), initExpr(nullptr ) {}
6787+
6788+ BodyInitKindAndExpr (BodyInitKind initKind, ApplyExpr *initExpr)
6789+ : initKind(initKind), initExpr(initExpr) {}
6790+
6791+ friend bool operator ==(BodyInitKindAndExpr lhs, BodyInitKindAndExpr rhs) {
6792+ return (lhs.initKind == rhs.initKind &&
6793+ lhs.initExpr == rhs.initExpr );
6794+ }
6795+ };
6796+
67736797// / ConstructorDecl - Declares a constructor for a type. For example:
67746798// /
67756799// / \code
@@ -6818,38 +6842,11 @@ class ConstructorDecl : public AbstractFunctionDecl {
68186842
68196843 ParamDecl **getImplicitSelfDeclStorage () { return &SelfDecl; }
68206844
6821- // / Specifies the kind of initialization call performed within the body
6822- // / of the constructor, e.g., self.init or super.init.
6823- enum class BodyInitKind {
6824- // / There are no calls to self.init or super.init.
6825- None,
6826- // / There is a call to self.init, which delegates to another (peer)
6827- // / initializer.
6828- Delegating,
6829- // / There is a call to super.init, which chains to a superclass initializer.
6830- Chained,
6831- // / There are no calls to self.init or super.init explicitly in the body of
6832- // / the constructor, but a 'super.init' call will be implicitly added
6833- // / by semantic analysis.
6834- ImplicitChained
6835- };
6836-
68376845 // / Determine whether the body of this constructor contains any delegating
68386846 // / or superclass initializations (\c self.init or \c super.init,
68396847 // / respectively) within its body.
6840- // /
6841- // / \param diags If non-null, this check will ensure that the constructor
6842- // / body is consistent in its use of delegation vs. chaining and emit any
6843- // / diagnostics through the given diagnostic engine.
6844- // /
6845- // / \param init If non-null and there is an explicit \c self.init or
6846- // / \c super.init within the body, will be set to point at that
6847- // / initializer.
6848- BodyInitKind getDelegatingOrChainedInitKind (DiagnosticEngine *diags,
6849- ApplyExpr **init = nullptr ) const ;
6850- void clearCachedDelegatingOrChainedInitKind () {
6851- Bits.ConstructorDecl .ComputedBodyInitKind = 0 ;
6852- }
6848+ BodyInitKindAndExpr getDelegatingOrChainedInitKind () const ;
6849+ void clearCachedDelegatingOrChainedInitKind ();
68536850
68546851 // / Whether this constructor is required.
68556852 bool isRequired () const {
0 commit comments