mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
SIL: Introduce lowered SILLayouts.
This gives us a concept we can eventually use to cache the lowered physical layout of fragile structs and classes, and more immediately, concretize the layout of closure boxes in a way that lets us represent the capture of generic environments and multiple captured values without compromising the "nominal" nature of box layouts. To start exercising the basic implementation, change the representation of SILBoxType to be in terms of a SILLayout, though avoid any immediate functionality change by preserving the single-boxed-type interface for now.
This commit is contained in:
@@ -85,6 +85,7 @@ namespace swift {
|
||||
class Substitution;
|
||||
class TypeCheckerDebugConsumer;
|
||||
class DocComment;
|
||||
class SILBoxType;
|
||||
|
||||
enum class KnownProtocolKind : uint8_t;
|
||||
|
||||
@@ -156,6 +157,8 @@ public:
|
||||
~ConstraintCheckerArenaRAII();
|
||||
};
|
||||
|
||||
class SILLayout; // From SIL
|
||||
|
||||
/// \brief Describes either a nominal type declaration or an extension
|
||||
/// declaration.
|
||||
typedef llvm::PointerUnion<NominalTypeDecl *, ExtensionDecl *>
|
||||
@@ -784,6 +787,10 @@ public:
|
||||
clang::ObjCInterfaceDecl *classDecl,
|
||||
bool forInstance);
|
||||
|
||||
/// Retrieve a generic signature with a single unconstrained type parameter,
|
||||
/// like `<T>`.
|
||||
CanGenericSignature getSingleGenericParameterSignature() const;
|
||||
|
||||
/// Whether our effective Swift version is in the Swift 3 family
|
||||
bool isSwiftVersion3() const { return LangOpts.isSwiftVersion3(); }
|
||||
|
||||
@@ -821,6 +828,12 @@ private:
|
||||
|
||||
friend class ArchetypeType;
|
||||
friend class ArchetypeBuilder::PotentialArchetype;
|
||||
|
||||
/// Provide context-level uniquing for SIL lowered type layouts.
|
||||
friend SILLayout;
|
||||
llvm::FoldingSet<SILLayout> *&getSILLayouts();
|
||||
friend SILBoxType;
|
||||
llvm::DenseMap<CanType, SILBoxType *> &getSILBoxTypes();
|
||||
};
|
||||
|
||||
/// Retrieve information about the given Objective-C method for
|
||||
|
||||
Reference in New Issue
Block a user