mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[sil] Add support for UnsafeRawPointer to SILType and ASTSynthesis.
I am going to be using this type in some of the Builtins that I am adding. Just chopping off part of the patch before I commit anything.
This commit is contained in:
@@ -52,13 +52,14 @@ enum SingletonTypeSynthesizer {
|
||||
_rawUnsafeContinuation,
|
||||
_void,
|
||||
_word,
|
||||
_swiftInt, // Swift.Int
|
||||
_serialExecutor, // the '_Concurrency.SerialExecutor' protocol
|
||||
_taskExecutor, // the '_Concurrency.TaskExecutor' protocol
|
||||
_actor, // the '_Concurrency.Actor' protocol
|
||||
_distributedActor, // the 'Distributed.DistributedActor' protocol
|
||||
_swiftInt, // Swift.Int
|
||||
_serialExecutor, // the '_Concurrency.SerialExecutor' protocol
|
||||
_taskExecutor, // the '_Concurrency.TaskExecutor' protocol
|
||||
_actor, // the '_Concurrency.Actor' protocol
|
||||
_distributedActor, // the 'Distributed.DistributedActor' protocol
|
||||
_unsafeRawBufferPointer, // UnsafeRawBufferPointer
|
||||
_unconstrainedAny, // any ~Copyable & ~Escapable
|
||||
_unconstrainedAny, // any ~Copyable & ~Escapable
|
||||
_unsafeRawPointer, // UnsafeRawPointer
|
||||
};
|
||||
inline Type synthesizeType(SynthesisContext &SC,
|
||||
SingletonTypeSynthesizer kind) {
|
||||
@@ -93,6 +94,8 @@ inline Type synthesizeType(SynthesisContext &SC,
|
||||
->getDeclaredInterfaceType();
|
||||
case _unsafeRawBufferPointer:
|
||||
return SC.Context.getUnsafeRawBufferPointerType();
|
||||
case _unsafeRawPointer:
|
||||
return SC.Context.getUnsafeRawPointerType();
|
||||
case _copyable:
|
||||
return SC.Context.getProtocol(KnownProtocolKind::Copyable)
|
||||
->getDeclaredInterfaceType();
|
||||
|
||||
@@ -1067,6 +1067,9 @@ public:
|
||||
/// Return Builtin.ImplicitActor.
|
||||
static SILType getBuiltinImplicitActorType(const ASTContext &ctx);
|
||||
|
||||
/// Return UnsafeRawPointer.
|
||||
static SILType getUnsafeRawPointer(const ASTContext &ctx);
|
||||
|
||||
//
|
||||
// Utilities for treating SILType as a pointer-like type.
|
||||
//
|
||||
|
||||
@@ -136,6 +136,11 @@ SILType SILType::getBuiltinImplicitActorType(const ASTContext &ctx) {
|
||||
return getPrimitiveObjectType(ctx.TheImplicitActorType->getCanonicalType());
|
||||
}
|
||||
|
||||
SILType SILType::getUnsafeRawPointer(const ASTContext &ctx) {
|
||||
return getPrimitiveObjectType(
|
||||
ctx.getUnsafeRawPointerType()->getCanonicalType());
|
||||
}
|
||||
|
||||
bool SILType::isTrivial(const SILFunction &F) const {
|
||||
auto contextType = hasTypeParameter() ? F.mapTypeIntoContext(*this) : *this;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user