@@ -403,10 +403,13 @@ class alignas(1 << DeclAlignInBits) Decl {
403
403
SWIFT_INLINE_BITFIELD (SubscriptDecl, VarDecl, 2 ,
404
404
StaticSpelling : 2
405
405
);
406
- SWIFT_INLINE_BITFIELD (AbstractFunctionDecl, ValueDecl, 3 +8 +1 +1 +1 +1 +1 +1 ,
406
+ SWIFT_INLINE_BITFIELD (AbstractFunctionDecl, ValueDecl, 3 +2 + 8 +1 +1 +1 +1 +1 +1 ,
407
407
// / \see AbstractFunctionDecl::BodyKind
408
408
BodyKind : 3 ,
409
409
410
+ // / \see AbstractFunctionDecl::SILSynthesizeKind
411
+ SILSynthesizeKind : 2 ,
412
+
410
413
// / Import as member status.
411
414
IAMStatus : 8 ,
412
415
@@ -5773,6 +5776,15 @@ class AbstractFunctionDecl : public GenericContext, public ValueDecl {
5773
5776
friend class NeedsNewVTableEntryRequest ;
5774
5777
5775
5778
public:
5779
+ // / records the kind of SILGen-synthesized body this decl represents
5780
+ enum class SILSynthesizeKind {
5781
+ None,
5782
+ MemberwiseInitializer,
5783
+ DistributedActorFactory
5784
+
5785
+ // This enum currently needs to fit in a 2-bit bitfield.
5786
+ };
5787
+
5776
5788
enum class BodyKind {
5777
5789
// / The function did not have a body in the source code file.
5778
5790
None,
@@ -5792,8 +5804,8 @@ class AbstractFunctionDecl : public GenericContext, public ValueDecl {
5792
5804
// / Function body is present and type-checked.
5793
5805
TypeChecked,
5794
5806
5795
- // / This is a memberwise initializer that will be synthesized by SILGen.
5796
- MemberwiseInitializer ,
5807
+ // Function body will be synthesized by SILGen.
5808
+ SILSynthesize ,
5797
5809
5798
5810
// / Function body text was deserialized from a .swiftmodule.
5799
5811
Deserialized
@@ -5893,6 +5905,14 @@ class AbstractFunctionDecl : public GenericContext, public ValueDecl {
5893
5905
Bits.AbstractFunctionDecl .BodyKind = unsigned (K);
5894
5906
}
5895
5907
5908
+ void setSILSynthesizeKind (SILSynthesizeKind K) {
5909
+ Bits.AbstractFunctionDecl .SILSynthesizeKind = unsigned (K);
5910
+ }
5911
+
5912
+ SILSynthesizeKind getSILSynthesizeKind () const {
5913
+ return SILSynthesizeKind (Bits.AbstractFunctionDecl .SILSynthesizeKind );
5914
+ }
5915
+
5896
5916
public:
5897
5917
void setHasSingleExpressionBody (bool Has = true ) {
5898
5918
Bits.AbstractFunctionDecl .HasSingleExpressionBody = Has;
@@ -6069,7 +6089,17 @@ class AbstractFunctionDecl : public GenericContext, public ValueDecl {
6069
6089
void setIsMemberwiseInitializer () {
6070
6090
assert (getBodyKind () == BodyKind::None);
6071
6091
assert (isa<ConstructorDecl>(this ));
6072
- setBodyKind (BodyKind::MemberwiseInitializer);
6092
+ setBodyKind (BodyKind::SILSynthesize);
6093
+ setSILSynthesizeKind (SILSynthesizeKind::MemberwiseInitializer);
6094
+ }
6095
+
6096
+ // / Mark that the body should be filled in to be a factory method for creating
6097
+ // / a distributed actor.
6098
+ void setDistributedActorFactory () {
6099
+ assert (getBodyKind () == BodyKind::None);
6100
+ assert (isa<FuncDecl>(this ));
6101
+ setBodyKind (BodyKind::SILSynthesize);
6102
+ setSILSynthesizeKind (SILSynthesizeKind::DistributedActorFactory);
6073
6103
}
6074
6104
6075
6105
// / Gets the body of this function, stripping the unused portions of #if
@@ -6093,7 +6123,8 @@ class AbstractFunctionDecl : public GenericContext, public ValueDecl {
6093
6123
}
6094
6124
6095
6125
bool isMemberwiseInitializer () const {
6096
- return getBodyKind () == BodyKind::MemberwiseInitializer;
6126
+ return getBodyKind () == BodyKind::SILSynthesize
6127
+ && getSILSynthesizeKind () == SILSynthesizeKind::MemberwiseInitializer;
6097
6128
}
6098
6129
6099
6130
// / For a method of a class, checks whether it will require a new entry in the
0 commit comments