Skip to content

Commit

Permalink
[BitwiseCopyable] Remove underscore.
Browse files Browse the repository at this point in the history
  • Loading branch information
nate-chandler committed Apr 24, 2024
1 parent 016489e commit d45c90c
Show file tree
Hide file tree
Showing 41 changed files with 152 additions and 149 deletions.
2 changes: 1 addition & 1 deletion include/swift/AST/DiagnosticsSema.def
Original file line number Diff line number Diff line change
Expand Up @@ -7735,7 +7735,7 @@ ERROR(non_bitwise_copyable_type_cxx_nontrivial,none,
ERROR(non_bitwise_copyable_c_type_nontrivial,none,
"type with unrepresentable fields cannot derive conformance to 'BitwiseCopyable'", ())
NOTE(note_non_bitwise_copyable_c_type_add_attr,none,
"annotate the type __attribute__((__swift_attr__(\"_BitwiseCopyable\")))",())
"annotate the type __attribute__((__swift_attr__(\"BitwiseCopyable\")))",())
ERROR(non_bitwise_copyable_type_member,none,
"%select{stored property %2|associated value %2}1 of "
"'BitwiseCopyable'-conforming %kind3 has non-bitwise-copyable type %0",
Expand Down
2 changes: 1 addition & 1 deletion include/swift/AST/KnownProtocols.def
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ PROTOCOL(FloatingPoint)
INVERTIBLE_PROTOCOL_WITH_NAME(Name, #Name)
#include "swift/ABI/InvertibleProtocols.def"

REPRESSIBLE_PROTOCOL_(BitwiseCopyable)
REPRESSIBLE_PROTOCOL(BitwiseCopyable)

EXPRESSIBLE_BY_LITERAL_PROTOCOL(ExpressibleByArrayLiteral, "Array", false)
EXPRESSIBLE_BY_LITERAL_PROTOCOL(ExpressibleByBooleanLiteral, "BooleanLiteralType", true)
Expand Down
2 changes: 1 addition & 1 deletion lib/ClangImporter/ImportDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8028,7 +8028,7 @@ ClangImporter::Implementation::importSwiftAttrAttributes(Decl *MappedDecl) {
continue;
}

if (swiftAttr->getAttribute() == "_BitwiseCopyable") {
if (swiftAttr->getAttribute() == "BitwiseCopyable") {
auto *protocol =
SwiftContext.getProtocol(KnownProtocolKind::BitwiseCopyable);
auto *nominal = dyn_cast<NominalTypeDecl>(MappedDecl);
Expand Down
4 changes: 2 additions & 2 deletions lib/SIL/IR/TypeLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3199,7 +3199,7 @@ void TypeConverter::verifyTrivialLowering(const TypeLowering &lowering,
// conforming.
if (!nominal) {
llvm::errs()
<< "Non-nominal type without conformance to _BitwiseCopyable:\n"
<< "Non-nominal type without conformance to BitwiseCopyable:\n"
<< ty << "\n"
<< "within " << substType << "\n"
<< "of " << origType << "\n";
Expand Down Expand Up @@ -3310,7 +3310,7 @@ void TypeConverter::verifyTrivialLowering(const TypeLowering &lowering,
return true;
});
if (hasNoConformingArchetypeNode) {
llvm::errs() << "Non-trivial type with _BitwiseCopyable conformance!?:\n"
llvm::errs() << "Non-trivial type with BitwiseCopyable conformance!?:\n"
<< substType << "\n";
conformance.print(llvm::errs());
llvm::errs() << "\n"
Expand Down
4 changes: 2 additions & 2 deletions stdlib/public/core/CommandLine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ internal func _swift_stdlib_getUnsafeArgvArgc(_: UnsafeMutablePointer<Int32>)
/// Command-line arguments for the current process.
#if $BitwiseCopyable && $ConformanceSuppression
@frozen // namespace
public enum CommandLine : ~_BitwiseCopyable {
public enum CommandLine : ~BitwiseCopyable {
}
#else
@frozen // namespace
public enum CommandLine {
}
@available(*, unavailable)
extension CommandLine : _BitwiseCopyable {}
extension CommandLine : BitwiseCopyable {}
#endif

extension CommandLine {
Expand Down
6 changes: 3 additions & 3 deletions stdlib/public/core/KeyPath.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1857,12 +1857,12 @@ internal struct RawKeyPathComponent {
}
}

internal func _pop<T : _BitwiseCopyable>(from: inout UnsafeRawBufferPointer,
internal func _pop<T : BitwiseCopyable>(from: inout UnsafeRawBufferPointer,
as type: T.Type) -> T {
let buffer = _pop(from: &from, as: type, count: 1)
return buffer.baseAddress.unsafelyUnwrapped.pointee
}
internal func _pop<T : _BitwiseCopyable>(from: inout UnsafeRawBufferPointer,
internal func _pop<T : BitwiseCopyable>(from: inout UnsafeRawBufferPointer,
as: T.Type,
count: Int) -> UnsafeBufferPointer<T> {
from = MemoryLayout<T>._roundingUpBaseToAlignment(from)
Expand Down Expand Up @@ -3482,7 +3482,7 @@ internal struct InstantiateKeyPathBuffer: KeyPathPatternVisitor {
}
return (baseAddress, misalign)
}
mutating func pushDest<T : _BitwiseCopyable>(_ value: T) {
mutating func pushDest<T : BitwiseCopyable>(_ value: T) {
let size = MemoryLayout<T>.size
let (baseAddress, misalign) = adjustDestForAlignment(of: T.self)
_withUnprotectedUnsafeBytes(of: value) {
Expand Down
4 changes: 2 additions & 2 deletions stdlib/public/core/MemoryLayout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@
/// alignment: MemoryLayout<Point>.alignment)
#if $BitwiseCopyable && $ConformanceSuppression
@frozen // namespace
public enum MemoryLayout<T: ~Copyable>: ~_BitwiseCopyable, Copyable {}
public enum MemoryLayout<T: ~Copyable>: ~BitwiseCopyable, Copyable {}
#else
@frozen // namespace
public enum MemoryLayout<T: ~Copyable>: Copyable {}
@available(*, unavailable)
extension MemoryLayout: _BitwiseCopyable {}
extension MemoryLayout: BitwiseCopyable {}
#endif

extension MemoryLayout where T: ~Copyable {
Expand Down
7 changes: 5 additions & 2 deletions stdlib/public/core/Misc.swift
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,10 @@ func _rethrowsViaClosure(_ fn: () throws -> ()) rethrows {
@_marker public protocol Escapable {}

#if $NoncopyableGenerics && $NonescapableTypes
@_marker public protocol _BitwiseCopyable: ~Escapable { }
@_marker public protocol BitwiseCopyable: ~Escapable { }
#else
@_marker public protocol _BitwiseCopyable { }
@_marker public protocol BitwiseCopyable { }
#endif

@available(*, unavailable)
@_marker public protocol _BitwiseCopyable {}
2 changes: 1 addition & 1 deletion stdlib/public/core/Optional.swift
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ extension Optional: Copyable /* where Wrapped: Copyable */ {}

extension Optional: Sendable where Wrapped: ~Copyable & Sendable { }

extension Optional: _BitwiseCopyable where Wrapped: _BitwiseCopyable { }
extension Optional: BitwiseCopyable where Wrapped: BitwiseCopyable { }

@_preInverseGenerics
extension Optional: ExpressibleByNilLiteral where Wrapped: ~Copyable {
Expand Down
2 changes: 1 addition & 1 deletion stdlib/public/core/Pointer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public protocol _Pointer:
Strideable,
_CustomDebugStringConvertibleOrNone,
_CustomReflectableOrNone,
_BitwiseCopyable
BitwiseCopyable
{
/// A type that represents the distance between two pointers.
typealias Distance = Int
Expand Down
8 changes: 4 additions & 4 deletions stdlib/public/core/SIMDVector.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ prefix operator .!
/// elementwise accesses. Computational operations are defined on the `SIMD`
/// protocol, which refines this protocol, and on the concrete types that
/// conform to `SIMD`.
public protocol SIMDStorage : _BitwiseCopyable {
public protocol SIMDStorage : BitwiseCopyable {
/// The type of scalars in the vector space.
#if $Embedded
associatedtype Scalar: Hashable
Expand Down Expand Up @@ -64,7 +64,7 @@ extension SIMDStorage {
}

/// A type that can be used as an element in a SIMD vector.
public protocol SIMDScalar : _BitwiseCopyable {
public protocol SIMDScalar : BitwiseCopyable {
associatedtype SIMDMaskScalar: SIMDScalar & FixedWidthInteger & SignedInteger
where SIMDMaskScalar.SIMDMaskScalar == SIMDMaskScalar
associatedtype SIMD2Storage: SIMDStorage where SIMD2Storage.Scalar == Self
Expand All @@ -81,7 +81,7 @@ public protocol SIMD<Scalar>:
SIMDStorage,
Hashable,
ExpressibleByArrayLiteral,
_BitwiseCopyable
BitwiseCopyable
{
/// The mask type resulting from pointwise comparisons of this vector type.
associatedtype MaskStorage: SIMD
Expand All @@ -97,7 +97,7 @@ public protocol SIMD<Scalar>:
Hashable,
CustomStringConvertible,
ExpressibleByArrayLiteral,
_BitwiseCopyable
BitwiseCopyable
{
/// The mask type resulting from pointwise comparisons of this vector type.
associatedtype MaskStorage: SIMD
Expand Down
2 changes: 1 addition & 1 deletion stdlib/public/core/Unicode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ public func transcode<Input, InputEncoding, OutputEncoding>(
/// A namespace for Unicode utilities.
#if $BitwiseCopyable && $ConformanceSuppression
@frozen
public enum Unicode : ~_BitwiseCopyable {}
public enum Unicode : ~BitwiseCopyable {}
#else
@frozen
public enum Unicode {}
Expand Down
4 changes: 2 additions & 2 deletions stdlib/public/core/UnsafeBufferPointerSlice.swift
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ extension Slice where Base == UnsafeMutableRawBufferPointer {
#if $BitwiseCopyable
@inlinable
@_alwaysEmitIntoClient
public func loadUnaligned<T : _BitwiseCopyable>(
public func loadUnaligned<T : BitwiseCopyable>(
fromByteOffset offset: Int = 0,
as type: T.Type
) -> T {
Expand Down Expand Up @@ -620,7 +620,7 @@ extension Slice where Base == UnsafeRawBufferPointer {
#if $BitwiseCopyable
@inlinable
@_alwaysEmitIntoClient
public func loadUnaligned<T : _BitwiseCopyable>(
public func loadUnaligned<T : BitwiseCopyable>(
fromByteOffset offset: Int = 0,
as type: T.Type
) -> T {
Expand Down
2 changes: 1 addition & 1 deletion stdlib/public/core/UnsafeRawBufferPointer.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ extension Unsafe${Mutable}RawBufferPointer {
/// memory.
#if $BitwiseCopyable
@_alwaysEmitIntoClient
public func loadUnaligned<T : _BitwiseCopyable>(
public func loadUnaligned<T : BitwiseCopyable>(
fromByteOffset offset: Int = 0,
as type: T.Type
) -> T {
Expand Down
6 changes: 3 additions & 3 deletions stdlib/public/core/UnsafeRawPointer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ extension UnsafeRawPointer {
/// with the value in the range of memory referenced by this pointer.
@inlinable
@_alwaysEmitIntoClient
public func loadUnaligned<T: _BitwiseCopyable>(
public func loadUnaligned<T: BitwiseCopyable>(
fromByteOffset offset: Int = 0,
as type: T.Type
) -> T {
Expand Down Expand Up @@ -1313,7 +1313,7 @@ extension UnsafeMutableRawPointer {
/// with the value in the range of memory referenced by this pointer.
@inlinable
@_alwaysEmitIntoClient
public func loadUnaligned<T: _BitwiseCopyable>(
public func loadUnaligned<T: BitwiseCopyable>(
fromByteOffset offset: Int = 0,
as type: T.Type
) -> T {
Expand Down Expand Up @@ -1400,7 +1400,7 @@ extension UnsafeMutableRawPointer {
/// - type: The type of `value`.
@inlinable
@_alwaysEmitIntoClient
public func storeBytes<T: _BitwiseCopyable>(
public func storeBytes<T: BitwiseCopyable>(
of value: T, toByteOffset offset: Int = 0, as type: T.Type
) {
#if $BuiltinStoreRaw
Expand Down
2 changes: 1 addition & 1 deletion test/Frontend/bitwise-copyable-flag.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

// Verify that the BitwiseCopyable feature flag works both in asserts and noasserts builds.

struct S : _BitwiseCopyable {
struct S : BitwiseCopyable {
}
2 changes: 1 addition & 1 deletion test/IRGen/bitwise-copyable-derived-loadRaw.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

// Execute an unaligned load of SIMD16<UInt8> which conforms to a protocol derived from BitwiseCopyable.

public protocol MyBitwiseCopyable : _BitwiseCopyable {}
public protocol MyBitwiseCopyable : BitwiseCopyable {}

extension SIMD16 : MyBitwiseCopyable where Scalar.SIMD16Storage : MyBitwiseCopyable {}
extension UInt8.SIMD16Storage : MyBitwiseCopyable {}
Expand Down
2 changes: 1 addition & 1 deletion test/IRGen/bitwise-copyable-loadRaw.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

// Execute an unaligned load of SIMD16<UInt8> which retroactively conforms directly to BitwiseCopyable.

extension SIMD16 : @retroactive _BitwiseCopyable where Scalar.SIMD16Storage : _BitwiseCopyable {}
extension SIMD16 : @retroactive BitwiseCopyable where Scalar.SIMD16Storage : BitwiseCopyable {}

func doit() {
let bytes: [UInt8] = Array(repeating: 0, count: 64)
Expand Down
4 changes: 2 additions & 2 deletions test/IRGen/bitwise_copyable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
import Foundation
import Builtin

struct Box<T : _BitwiseCopyable> : _BitwiseCopyable {
struct Box<T : BitwiseCopyable> : BitwiseCopyable {
var t: T
}

struct Boxx<each T : _BitwiseCopyable> {
struct Boxx<each T : BitwiseCopyable> {
var ts: (repeat each T)
}

Expand Down
4 changes: 2 additions & 2 deletions test/IRGen/bitwise_copyable_onone.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// RUN: %FileCheck %s


// CHECK-LABEL: define{{.*}} ptr @"$s22bitwise_copyable_onone1EOy1AQzGAA1PRzs16_BitwiseCopyableAERQlWOh"(
// CHECK-LABEL: define{{.*}} ptr @"$s22bitwise_copyable_onone1EOy1AQzGAA1PRzs16BitwiseCopyableAERQlWOh"(
// CHECK-SAME: ptr %0,
// CHECK-SAME: ptr %I.A,
// CHECK-SAME: ptr %"E<I.A>"
Expand All @@ -21,7 +21,7 @@ protocol P {
associatedtype A
}

class C<I: P> where I.A: _BitwiseCopyable {
class C<I: P> where I.A: BitwiseCopyable {
func takeE(_ event: E<I.A>) {}
func run(_ e: I.A) {
takeE(.next(e))
Expand Down
8 changes: 4 additions & 4 deletions test/IRGen/bitwise_copyable_resilient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,22 @@ public struct Integer {
//--- Downstream.swift
import Library

func take<T: _BitwiseCopyable>(_ t: T) {}
func take<T: BitwiseCopyable>(_ t: T) {}

struct S_Explicit_With_Oopsional<T> : _BitwiseCopyable {
struct S_Explicit_With_Oopsional<T> : BitwiseCopyable {
var o: Oopsional<T> // expected-error{{non_bitwise_copyable_type_member}}
}

func passOopsional<T>(_ t: Oopsional<T>) { take(t) } // expected-error {{type_does_not_conform_decl_owner}}
// expected-note@-7 {{where_requirement_failure_one_subst}}


struct S_Explicit_With_Woopsional<T> : _BitwiseCopyable {
struct S_Explicit_With_Woopsional<T> : BitwiseCopyable {
var o: Woopsional<T> // expected-error{{non_bitwise_copyable_type_member}}
}

func passWoopsional<T>(_ t: Woopsional<T>) { take(t) } // expected-error {{type_does_not_conform_decl_owner}}
// expected-note@-15 {{where_requirement_failure_one_subst}}

extension Integer : @retroactive _BitwiseCopyable {} // expected-error {{bitwise_copyable_outside_module}}
extension Integer : @retroactive BitwiseCopyable {} // expected-error {{bitwise_copyable_outside_module}}

2 changes: 1 addition & 1 deletion test/ModuleInterface/bitwise_copyable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
@_moveOnly
public struct S_Implicit_Noncopyable {}

// CHECK-NOT: extension Test.S_Implicit_Noncopyable : Swift._BitwiseCopyable {}
// CHECK-NOT: extension Test.S_Implicit_Noncopyable : Swift.BitwiseCopyable {}
Loading

0 comments on commit d45c90c

Please sign in to comment.