@@ -52,6 +52,7 @@ class FuncDecl;
52
52
class ClassDecl ;
53
53
class GenericFunctionType ;
54
54
class LazyConformanceLoader ;
55
+ class LazyMemberLoader ;
55
56
class PatternBindingInitializer ;
56
57
class TrailingWhereClause ;
57
58
@@ -1010,18 +1011,31 @@ class DynamicReplacementAttr final
1010
1011
: public DeclAttribute,
1011
1012
private llvm::TrailingObjects<DynamicReplacementAttr, SourceLoc> {
1012
1013
friend TrailingObjects;
1014
+ friend class DynamicallyReplacedDeclRequest ;
1013
1015
1014
1016
DeclName ReplacedFunctionName;
1015
- AbstractFunctionDecl *ReplacedFunction;
1017
+ LazyMemberLoader *Resolver = nullptr ;
1018
+ uint64_t ResolverContextData;
1016
1019
1017
1020
// / Create an @_dynamicReplacement(for:) attribute written in the source.
1018
1021
DynamicReplacementAttr (SourceLoc atLoc, SourceRange baseRange,
1019
1022
DeclName replacedFunctionName, SourceRange parenRange);
1020
1023
1021
- explicit DynamicReplacementAttr (DeclName name)
1024
+ DynamicReplacementAttr (DeclName name, AbstractFunctionDecl *f )
1022
1025
: DeclAttribute(DAK_DynamicReplacement, SourceLoc(), SourceRange(),
1023
1026
/* Implicit=*/ false ),
1024
- ReplacedFunctionName(name), ReplacedFunction(nullptr ) {
1027
+ ReplacedFunctionName (name),
1028
+ Resolver(nullptr ), ResolverContextData(0 ) {
1029
+ Bits.DynamicReplacementAttr .HasTrailingLocationInfo = false ;
1030
+ }
1031
+
1032
+ DynamicReplacementAttr (DeclName name,
1033
+ LazyMemberLoader *Resolver = nullptr ,
1034
+ uint64_t Data = 0 )
1035
+ : DeclAttribute(DAK_DynamicReplacement, SourceLoc(), SourceRange(),
1036
+ /* Implicit=*/ false),
1037
+ ReplacedFunctionName(name),
1038
+ Resolver(Resolver), ResolverContextData(Data) {
1025
1039
Bits.DynamicReplacementAttr .HasTrailingLocationInfo = false ;
1026
1040
}
1027
1041
@@ -1045,25 +1059,18 @@ class DynamicReplacementAttr final
1045
1059
SourceLoc LParenLoc, DeclName replacedFunction, SourceLoc RParenLoc);
1046
1060
1047
1061
static DynamicReplacementAttr *create (ASTContext &ctx,
1048
- DeclName replacedFunction);
1062
+ DeclName replacedFunction,
1063
+ AbstractFunctionDecl *replacedFuncDecl);
1049
1064
1050
1065
static DynamicReplacementAttr *create (ASTContext &ctx,
1051
1066
DeclName replacedFunction,
1052
- AbstractFunctionDecl *replacedFuncDecl);
1067
+ LazyMemberLoader *Resolver,
1068
+ uint64_t Data);
1053
1069
1054
1070
DeclName getReplacedFunctionName () const {
1055
1071
return ReplacedFunctionName;
1056
1072
}
1057
1073
1058
- AbstractFunctionDecl *getReplacedFunction () const {
1059
- return ReplacedFunction;
1060
- }
1061
-
1062
- void setReplacedFunction (AbstractFunctionDecl *f) {
1063
- assert (ReplacedFunction == nullptr );
1064
- ReplacedFunction = f;
1065
- }
1066
-
1067
1074
// / Retrieve the location of the opening parentheses, if there is one.
1068
1075
SourceLoc getLParenLoc () const ;
1069
1076
0 commit comments