Skip to content

Commit d5f67eb

Browse files
committed
Mark some UnsafePointer APIs as transparent
1 parent 07edd9c commit d5f67eb

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

stdlib/public/core/UnsafePointer.swift

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,8 @@ extension UnsafePointer where Pointee: ~Copyable {
262262
/// This pointer must be a pointer to the start of a previously allocated
263263
/// memory block. The memory must not be initialized or `Pointee` must be a
264264
/// trivial type.
265-
@inlinable
266265
@_preInverseGenerics
266+
@_transparent
267267
public func deallocate() {
268268
// Passing zero alignment to the runtime forces "aligned
269269
// deallocation". Since allocation via `UnsafeMutable[Raw][Buffer]Pointer`
@@ -777,8 +777,8 @@ extension UnsafeMutablePointer where Pointee: ~Copyable {
777777
///
778778
/// - Parameter count: The amount of memory to allocate, counted in instances
779779
/// of `Pointee`.
780-
@inlinable
781780
@_preInverseGenerics
781+
@_transparent
782782
public static func allocate(
783783
capacity count: Int
784784
) -> UnsafeMutablePointer<Pointee> {
@@ -810,8 +810,8 @@ extension UnsafeMutablePointer where Pointee: ~Copyable {
810810
/// This pointer must be a pointer to the start of a previously allocated
811811
/// memory block. The memory must not be initialized or `Pointee` must be a
812812
/// trivial type.
813-
@inlinable
814813
@_preInverseGenerics
814+
@_transparent
815815
public func deallocate() {
816816
// Passing zero alignment to the runtime forces "aligned
817817
// deallocation". Since allocation via `UnsafeMutable[Raw][Buffer]Pointer`
@@ -898,6 +898,7 @@ extension UnsafeMutablePointer where Pointee: ~Copyable {
898898
/// - Parameters:
899899
/// - value: The instance to initialize this pointer's pointee to.
900900
@_alwaysEmitIntoClient
901+
@_transparent
901902
public func initialize(to value: consuming Pointee) {
902903
Builtin.initialize(value, self._rawValue)
903904
}
@@ -928,8 +929,8 @@ extension UnsafeMutablePointer where Pointee: ~Copyable {
928929
/// `move()`, the memory is uninitialized.
929930
///
930931
/// - Returns: The instance referenced by this pointer.
931-
@inlinable
932932
@_preInverseGenerics
933+
@_transparent
933934
public func move() -> Pointee {
934935
return Builtin.take(_rawValue)
935936
}
@@ -1162,9 +1163,9 @@ extension UnsafeMutablePointer where Pointee: ~Copyable {
11621163
/// not be negative.
11631164
/// - Returns: A raw pointer to the same address as this pointer. The memory
11641165
/// referenced by the returned raw pointer is still bound to `Pointee`.
1165-
@inlinable
1166-
@_preInverseGenerics
11671166
@discardableResult
1167+
@_preInverseGenerics
1168+
@_transparent
11681169
public func deinitialize(count: Int) -> UnsafeMutableRawPointer {
11691170
_debugPrecondition(count >= 0, "UnsafeMutablePointer.deinitialize with negative count")
11701171
// Note: When count is statically known to be 1 the compiler will optimize

0 commit comments

Comments
 (0)