mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
AST: GenericContexts store a GenericSignature instead of a GenericEnvironment
This eliminates the entire 'lazy generic environment' concept; essentially, all generic environments are now lazy, and since each signature has exactly one environment, their construction no longer needs to be co-ordinated with deserialization.
This commit is contained in:
@@ -1482,18 +1482,11 @@ public:
|
||||
/// moves the trailing where clause into the generic parameter list.
|
||||
TrailingWhereClause *TrailingWhere = nullptr;
|
||||
|
||||
/// The generic signature or environment of this declaration.
|
||||
///
|
||||
/// When this declaration stores only a signature, the generic
|
||||
/// environment will be lazily loaded.
|
||||
mutable llvm::PointerUnion<GenericSignature *, GenericEnvironment *>
|
||||
GenericSigOrEnv;
|
||||
/// The generic signature of this declaration.
|
||||
GenericSignature *GenericSig = nullptr;
|
||||
};
|
||||
|
||||
class GenericContext : private _GenericContext, public DeclContext {
|
||||
/// Lazily populate the generic environment.
|
||||
GenericEnvironment *getLazyGenericEnvironmentSlow() const;
|
||||
|
||||
protected:
|
||||
GenericContext(DeclContextKind Kind, DeclContext *Parent)
|
||||
: _GenericContext(), DeclContext(Kind, Parent) { }
|
||||
@@ -1542,18 +1535,12 @@ public:
|
||||
/// Retrieve the generic requirements.
|
||||
ArrayRef<Requirement> getGenericRequirements() const;
|
||||
|
||||
/// Set a lazy generic environment.
|
||||
void setLazyGenericEnvironment(LazyMemberLoader *lazyLoader,
|
||||
GenericSignature *genericSig,
|
||||
uint64_t genericEnvData);
|
||||
|
||||
/// Whether this generic context has a lazily-created generic environment
|
||||
/// that has not yet been constructed.
|
||||
bool hasLazyGenericEnvironment() const;
|
||||
|
||||
/// Set the generic context of this context.
|
||||
void setGenericEnvironment(GenericEnvironment *genericEnv);
|
||||
|
||||
/// Set the generic signature of this context.
|
||||
void setGenericSignature(GenericSignature *genericSig);
|
||||
|
||||
/// Retrieve the position of any where clause for this context's
|
||||
/// generic parameters.
|
||||
SourceRange getGenericTrailingWhereClauseSourceRange() const;
|
||||
|
||||
Reference in New Issue
Block a user