From f9435b9ce8dd4f8ba81fa983a09c73618f9275b8 Mon Sep 17 00:00:00 2001 From: Xiaodi Wu Date: Fri, 5 Aug 2016 03:19:43 -0500 Subject: [PATCH 1/3] [stdlib] Restore MemoryLayout.*(ofValue:) --- lib/Sema/MiscDiagnostics.cpp | 15 +++--- .../SwiftPrivateLibcExtras/Subprocess.swift | 2 +- stdlib/public/SDK/Foundation/Data.swift | 2 +- stdlib/public/core/BridgeObjectiveC.swift | 2 +- stdlib/public/core/Builtin.swift | 6 +-- stdlib/public/core/Character.swift | 2 +- stdlib/public/core/MemoryLayout.swift | 47 +++++++++++++------ stdlib/public/core/Unicode.swift | 2 +- stdlib/public/core/VarArgs.swift | 8 ++-- test/1_stdlib/Character.swift | 2 +- test/1_stdlib/Renames.swift | 3 -- test/Interpreter/SDK/c_pointers.swift | 2 +- test/Interpreter/enum.swift | 2 +- test/expr/expressions.swift | 6 +-- validation-test/stdlib/Arrays.swift.gyb | 4 +- validation-test/stdlib/Dictionary.swift | 4 +- .../stdlib/NSNumberBridging.swift.gyb | 2 +- validation-test/stdlib/OpenCLSDKOverlay.swift | 4 +- validation-test/stdlib/Set.swift | 4 +- 19 files changed, 64 insertions(+), 55 deletions(-) diff --git a/lib/Sema/MiscDiagnostics.cpp b/lib/Sema/MiscDiagnostics.cpp index 2059c86326675..0e77630168e2b 100644 --- a/lib/Sema/MiscDiagnostics.cpp +++ b/lib/Sema/MiscDiagnostics.cpp @@ -2145,9 +2145,6 @@ bool AvailabilityWalker::diagnoseMemoryLayoutMigration(const ValueDecl *D, .Case("sizeof", {"size", false}) .Case("alignof", {"alignment", false}) .Case("strideof", {"stride", false}) - .Case("sizeofValue", {"size", true}) - .Case("alignofValue", {"alignment", true}) - .Case("strideofValue", {"stride", true}) .Default({}); if (KindValue.first.empty()) @@ -2162,7 +2159,7 @@ bool AvailabilityWalker::diagnoseMemoryLayoutMigration(const ValueDecl *D, auto subject = args->getSubExpr(); if (!isValue) { - // sizeof(x.dynamicType) is equivalent to sizeofValue(x) + // sizeof(type(of: x)) is equivalent to sizeofValue(x) if (auto DTE = dyn_cast(subject)) { subject = DTE->getBase(); isValue = true; @@ -2179,14 +2176,14 @@ bool AvailabilityWalker::diagnoseMemoryLayoutMigration(const ValueDecl *D, if (isValue) { auto valueType = subject->getType()->getRValueType(); if (!valueType || valueType->is()) { - // If we dont have good argument, We cannot emit fix-it. - return true; + // If we don't have a suitable argument, we cannot emit a fix-it. + return true; } // NOTE: We are destructively replacing the source text here. - // For instance, `sizeof(x.doSomethig())` => `MemoryLayout.size` where - // T is return type of `doSomething()`. If that function have any - // side effects, it will break the source. + // `sizeof(type(of: doSomething()))` => `MemoryLayout.size`, where T is + // the return type of `doSomething()`. If that function has any side + // effects, this replacement will break the source. diag.fixItReplace(call->getSourceRange(), (Prefix + valueType->getString() + Suffix + Kind).str()); } else { diff --git a/stdlib/private/SwiftPrivateLibcExtras/Subprocess.swift b/stdlib/private/SwiftPrivateLibcExtras/Subprocess.swift index 40541fc00e331..24531f5de5e71 100644 --- a/stdlib/private/SwiftPrivateLibcExtras/Subprocess.swift +++ b/stdlib/private/SwiftPrivateLibcExtras/Subprocess.swift @@ -116,7 +116,7 @@ public func spawnChild(_ args: [String]) // If execve() encountered an error, we write the errno encountered to the // parent write pipe. - let errnoSize = MemoryLayout._ofInstance(errno).size + let errnoSize = MemoryLayout.size(ofValue: errno) var execveErrno = errno let writtenBytes = withUnsafePointer(to: &execveErrno) { write(childToParentPipe.writeFD, UnsafePointer($0), errnoSize) diff --git a/stdlib/public/SDK/Foundation/Data.swift b/stdlib/public/SDK/Foundation/Data.swift index ca7bc6ee693bb..22e0dcc7c2fb0 100644 --- a/stdlib/public/SDK/Foundation/Data.swift +++ b/stdlib/public/SDK/Foundation/Data.swift @@ -669,7 +669,7 @@ public struct Data : ReferenceConvertible, Equatable, Hashable, RandomAccessColl public mutating func next() -> UInt8? { guard _idx < _endIdx else { return nil } defer { _idx += 1 } - let bufferSize = MemoryLayout._ofInstance(_buffer).size + let bufferSize = MemoryLayout.size(ofValue: _buffer) return withUnsafeMutablePointer(to: &_buffer) { ptr_ in let ptr = UnsafeMutableRawPointer(ptr_).assumingMemoryBound(to: UInt8.self) let bufferIdx = _idx % bufferSize diff --git a/stdlib/public/core/BridgeObjectiveC.swift b/stdlib/public/core/BridgeObjectiveC.swift index ff03fc3f01c52..8e545d5f635cb 100644 --- a/stdlib/public/core/BridgeObjectiveC.swift +++ b/stdlib/public/core/BridgeObjectiveC.swift @@ -546,7 +546,7 @@ internal struct _CocoaFastEnumerationStackBuf { _item14 = _item0 _item15 = _item0 - _sanityCheck(MemoryLayout._ofInstance(self).size >= + _sanityCheck(MemoryLayout.size(ofValue: self) >= MemoryLayout>.size * count) } } diff --git a/stdlib/public/core/Builtin.swift b/stdlib/public/core/Builtin.swift index da8502ccd5732..96519cee4fe84 100644 --- a/stdlib/public/core/Builtin.swift +++ b/stdlib/public/core/Builtin.swift @@ -20,7 +20,7 @@ public func sizeof(_:T.Type) -> Int { Builtin.unreachable() } -@available(*, unavailable, message: "use MemoryLayout.size instead.") +@available(*, unavailable, renamed: "MemoryLayout.size(ofValue:)") public func sizeofValue(_:T) -> Int { Builtin.unreachable() } @@ -30,7 +30,7 @@ public func alignof(_:T.Type) -> Int { Builtin.unreachable() } -@available(*, unavailable, message: "use MemoryLayout.alignment instead.") +@available(*, unavailable, renamed: "MemoryLayout.alignment(ofValue:)") public func alignofValue(_:T) -> Int { Builtin.unreachable() } @@ -40,7 +40,7 @@ public func strideof(_:T.Type) -> Int { Builtin.unreachable() } -@available(*, unavailable, message: "use MemoryLayout.stride instead.") +@available(*, unavailable, renamed: "MemoryLayout.stride(ofValue:)") public func strideofValue(_:T) -> Int { Builtin.unreachable() } diff --git a/stdlib/public/core/Character.swift b/stdlib/public/core/Character.swift index 74fc63be01851..52d83eb3c5897 100644 --- a/stdlib/public/core/Character.swift +++ b/stdlib/public/core/Character.swift @@ -176,7 +176,7 @@ public struct Character : let (count, initialUTF8) = s._core._encodeSomeUTF8(from: 0) // Notice that the result of sizeof() is a small non-zero number and can't // overflow when multiplied by 8. - let bits = MemoryLayout._ofInstance(initialUTF8).size &* 8 &- 1 + let bits = MemoryLayout.size(ofValue: initialUTF8) &* 8 &- 1 if _fastPath( count == s._core.count && (initialUTF8 & (1 << numericCast(bits))) != 0) { _representation = .small(Builtin.trunc_Int64_Int63(initialUTF8._value)) diff --git a/stdlib/public/core/MemoryLayout.swift b/stdlib/public/core/MemoryLayout.swift index a588c99bda2c1..fdf3384136c26 100644 --- a/stdlib/public/core/MemoryLayout.swift +++ b/stdlib/public/core/MemoryLayout.swift @@ -12,30 +12,28 @@ /// The memory layout of a type, describing its size, stride, and alignment. public enum MemoryLayout { - - /// The contiguous memory footprint of the type. + /// The contiguous memory footprint of `T`. /// - /// The `size` property for a type `T` does not include any - /// dynamically-allocated or "remote" storage. In particular, - /// `MemoryLayout.size`, when `T` is a class type, is the same regardless - /// of how many stored properties `T` has. + /// Does not include any dynamically-allocated or "remote" storage. In + /// particular, `MemoryLayout.size`, when `T` is a class type, is the same + /// regardless of how many stored properties `T` has. @_transparent public static var size: Int { return Int(Builtin.sizeof(T.self)) } - /// The number of bytes from the start of one instance to the start of the - /// next, when stored in a contiguous array. + /// The number of bytes from the start of one instance of `T` to the start of + /// the next in an `Array`. /// /// This is the same as the number of bytes moved when an `UnsafePointer` - /// is incremented. The type may have a lower minimal alignment that trades - /// runtime performance for space efficiency. The result is always positive. + /// is incremented. `T` may have a lower minimal alignment that trades runtime + /// performance for space efficiency. The result is always positive. @_transparent public static var stride: Int { return Int(Builtin.strideof_nonzero(T.self)) } - /// The default memory alignment of the type. + /// The default memory alignment of `T`. @_transparent public static var alignment: Int { return Int(Builtin.alignof(T.self)) @@ -43,9 +41,30 @@ public enum MemoryLayout { } extension MemoryLayout { + /// Returns the contiguous memory footprint of `T`. + /// + /// Does not include any dynamically-allocated or "remote" storage. In + /// particular, `MemoryLayout.size(ofValue: x)`, when `x` is a class instance, + /// is the same regardless of how many stored properties `T` has. + @_transparent + public static func size(ofValue _: T) -> Int { + return MemoryLayout.size + } + + /// Returns the number of bytes from the start of one instance of `T` to the + /// start of the next in an `Array`. + /// + /// This is the same as the number of bytes moved when an `UnsafePointer` + /// is incremented. `T` may have a lower minimal alignment that trades runtime + /// performance for space efficiency. The result is always positive. + @_transparent + public static func stride(ofValue _: T) -> Int { + return MemoryLayout.stride + } + + /// Returns the default memory alignment of `T`. @_transparent - public // @testable - static func _ofInstance(_: @autoclosure () -> T) -> MemoryLayout.Type { - return MemoryLayout.self + public static func alignment(ofValue _: T) -> Int { + return MemoryLayout.alignment } } diff --git a/stdlib/public/core/Unicode.swift b/stdlib/public/core/Unicode.swift index 0589a2696b1f5..8cb414ac8083e 100644 --- a/stdlib/public/core/Unicode.swift +++ b/stdlib/public/core/Unicode.swift @@ -839,7 +839,7 @@ internal func _transcodeSomeUTF16AsUTF8( nextIndex = input.index(nextIndex, offsetBy: utf16Length) } // FIXME: Annoying check, courtesy of - if utf8Count < MemoryLayout._ofInstance(result).size { + if utf8Count < MemoryLayout.size(ofValue: result) { result |= ~0 << numericCast(utf8Count * 8) } return (nextIndex, result) diff --git a/stdlib/public/core/VarArgs.swift b/stdlib/public/core/VarArgs.swift index 08cd194366f1a..e4f12d90cb5e1 100644 --- a/stdlib/public/core/VarArgs.swift +++ b/stdlib/public/core/VarArgs.swift @@ -144,7 +144,7 @@ extension Int64 : CVarArg, _CVarArgAligned { /// the value returned by `_cVarArgEncoding`. public var _cVarArgAlignment: Int { // FIXME: alignof differs from the ABI alignment on some architectures - return MemoryLayout._ofInstance(self).alignment + return MemoryLayout.alignment(ofValue: self) } } @@ -192,7 +192,7 @@ extension UInt64 : CVarArg, _CVarArgAligned { /// the value returned by `_cVarArgEncoding`. public var _cVarArgAlignment: Int { // FIXME: alignof differs from the ABI alignment on some architectures - return MemoryLayout._ofInstance(self).alignment + return MemoryLayout.alignment(ofValue: self) } } @@ -265,7 +265,7 @@ extension Float : _CVarArgPassedAsDouble, _CVarArgAligned { /// the value returned by `_cVarArgEncoding`. public var _cVarArgAlignment: Int { // FIXME: alignof differs from the ABI alignment on some architectures - return MemoryLayout._ofInstance(Double(self)).alignment + return MemoryLayout.alignment(ofValue: Double(self)) } } @@ -280,7 +280,7 @@ extension Double : _CVarArgPassedAsDouble, _CVarArgAligned { /// the value returned by `_cVarArgEncoding`. public var _cVarArgAlignment: Int { // FIXME: alignof differs from the ABI alignment on some architectures - return MemoryLayout._ofInstance(self).alignment + return MemoryLayout.alignment(ofValue: self) } } diff --git a/test/1_stdlib/Character.swift b/test/1_stdlib/Character.swift index c408c60a73c08..767de776f7df9 100644 --- a/test/1_stdlib/Character.swift +++ b/test/1_stdlib/Character.swift @@ -142,7 +142,7 @@ CharacterTests.test("sizeof") { expectTrue(size1 == 8 || size1 == 9) var a: Character = "a" - let size2 = MemoryLayout._ofInstance(a).size + let size2 = MemoryLayout.size(ofValue: a) expectTrue(size2 == 8 || size2 == 9) expectEqual(size1, size2) diff --git a/test/1_stdlib/Renames.swift b/test/1_stdlib/Renames.swift index 9145816c1b9e6..585e7d6d14350 100644 --- a/test/1_stdlib/Renames.swift +++ b/test/1_stdlib/Renames.swift @@ -284,9 +284,6 @@ func _MemoryLayout(t: T) { _ = sizeof(T.self) // expected-error {{'sizeof' is unavailable: use MemoryLayout.size instead.}} {{7-14=MemoryLayout<}} {{15-21=>.size}} {{none}} _ = alignof(T.self) // expected-error {{'alignof' is unavailable: use MemoryLayout.alignment instead.}} {{7-15=MemoryLayout<}} {{16-22=>.alignment}} {{none}} _ = strideof(T.self) // expected-error {{'strideof' is unavailable: use MemoryLayout.stride instead.}} {{7-16=MemoryLayout<}} {{17-23=>.stride}} {{none}} - _ = sizeofValue(t) // expected-error {{'sizeofValue' is unavailable: use MemoryLayout.size instead.}} {{7-21=MemoryLayout.size}} {{none}} - _ = alignofValue(t) // expected-error {{'alignofValue' is unavailable: use MemoryLayout.alignment instead.}} {{7-22=MemoryLayout.alignment}} {{none}} - _ = strideofValue(t) // expected-error {{'strideofValue' is unavailable: use MemoryLayout.stride instead.}} {{7-23=MemoryLayout.stride}} {{none}} } func _Mirror() { diff --git a/test/Interpreter/SDK/c_pointers.swift b/test/Interpreter/SDK/c_pointers.swift index 3e577b35d54f1..17db0e5888d41 100644 --- a/test/Interpreter/SDK/c_pointers.swift +++ b/test/Interpreter/SDK/c_pointers.swift @@ -127,7 +127,7 @@ puts(s) // var unsorted = [3, 14, 15, 9, 2, 6, 5] -qsort(&unsorted, unsorted.count, MemoryLayout._ofInstance(unsorted[0]).size) { a, b in +qsort(&unsorted, unsorted.count, MemoryLayout.size(ofValue: unsorted[0])) { a, b in return Int32(a!.load(as: Int.self) - b!.load(as: Int.self)) } // CHECK-NEXT: [2, 3, 5, 6, 9, 14, 15] diff --git a/test/Interpreter/enum.swift b/test/Interpreter/enum.swift index adac8aef1297f..3959cefb204dd 100644 --- a/test/Interpreter/enum.swift +++ b/test/Interpreter/enum.swift @@ -440,7 +440,7 @@ struct OptionalTuple { } } func test_optional_generic_tuple(_ a: OptionalTuple) -> T { - print("optional pair is same size as pair: \(MemoryLayout._ofInstance(a).size == MemoryLayout.size*2)") + print("optional pair is same size as pair: \(MemoryLayout.size(ofValue: a) == MemoryLayout.size*2)") return a.value!.0 } print("Int result: \(test_optional_generic_tuple(OptionalTuple((5, 6))))") diff --git a/test/expr/expressions.swift b/test/expr/expressions.swift index 0448e8dab547c..f60462b1c40b0 100644 --- a/test/expr/expressions.swift +++ b/test/expr/expressions.swift @@ -891,9 +891,5 @@ func se0101(x: Cse0101

) { _ = sizeof(Cse0101

.self) // expected-error {{'sizeof' is unavailable: use MemoryLayout.size instead.}} {{7-14=MemoryLayout<}} {{24-30=>.size}} {{none}} _ = alignof(Cse0101

.T.self) // expected-error {{'alignof' is unavailable: use MemoryLayout.alignment instead.}} {{7-15=MemoryLayout<}} {{27-33=>.alignment}} {{none}} _ = strideof(P.Type.self) // expected-error {{'strideof' is unavailable: use MemoryLayout.stride instead.}} {{7-16=MemoryLayout<}} {{22-28=>.stride}} {{none}} - _ = sizeof(type(of: x)) // expected-error {{'sizeof' is unavailable: use MemoryLayout.size instead.}} {{7-26=MemoryLayout>.size}} {{none}}/ - - _ = sizeofValue(x) // expected-error {{'sizeofValue' is unavailable: use MemoryLayout.size instead.}} {{7-21=MemoryLayout>.size}} {{none}} - _ = alignofValue(x.val) // expected-error {{'alignofValue' is unavailable: use MemoryLayout.alignment instead.}} {{7-26=MemoryLayout

.alignment}} {{none}} - _ = strideofValue(x.val.getIt()) // expected-error {{'strideofValue' is unavailable: use MemoryLayout.stride instead.}} {{7-35=MemoryLayout.stride}} {{none}} + _ = sizeof(type(of: x)) // expected-error {{'sizeof' is unavailable: use MemoryLayout.size instead.}} {{7-26=MemoryLayout>.size}} {{none}} } diff --git a/validation-test/stdlib/Arrays.swift.gyb b/validation-test/stdlib/Arrays.swift.gyb index def3a35c474ad..fabdc2262cd9a 100644 --- a/validation-test/stdlib/Arrays.swift.gyb +++ b/validation-test/stdlib/Arrays.swift.gyb @@ -87,9 +87,9 @@ var ArrayTestSuite = TestSuite("Array") ArrayTestSuite.test("sizeof") { var a = [ 10, 20, 30 ] #if arch(i386) || arch(arm) - expectEqual(4, MemoryLayout._ofInstance(a).size) + expectEqual(4, MemoryLayout.size(ofValue: a)) #else - expectEqual(8, MemoryLayout._ofInstance(a).size) + expectEqual(8, MemoryLayout.size(ofValue: a)) #endif } diff --git a/validation-test/stdlib/Dictionary.swift b/validation-test/stdlib/Dictionary.swift index da78dfc999a10..4bb871138c34b 100644 --- a/validation-test/stdlib/Dictionary.swift +++ b/validation-test/stdlib/Dictionary.swift @@ -72,9 +72,9 @@ DictionaryTestSuite.test("AssociatedTypes") { DictionaryTestSuite.test("sizeof") { var dict = [1: "meow", 2: "meow"] #if arch(i386) || arch(arm) - expectEqual(4, MemoryLayout._ofInstance(dict).size) + expectEqual(4, MemoryLayout.size(ofValue: dict)) #else - expectEqual(8, MemoryLayout._ofInstance(dict).size) + expectEqual(8, MemoryLayout.size(ofValue: dict)) #endif } diff --git a/validation-test/stdlib/NSNumberBridging.swift.gyb b/validation-test/stdlib/NSNumberBridging.swift.gyb index 5d69d7d7599d8..6240bb1b997dd 100644 --- a/validation-test/stdlib/NSNumberBridging.swift.gyb +++ b/validation-test/stdlib/NSNumberBridging.swift.gyb @@ -151,7 +151,7 @@ extension ${Self} { func toNSNumberByteArray() -> [UInt8] { var v = self.bitPattern var result: [UInt8] = [] - for _ in 0 ..< MemoryLayout._ofInstance(v).size { + for _ in 0 ..< MemoryLayout.size(ofValue: v) { result.append(UInt8(v & 0xff)) v = v >> 8 } diff --git a/validation-test/stdlib/OpenCLSDKOverlay.swift b/validation-test/stdlib/OpenCLSDKOverlay.swift index d38631448a7fc..58959c51be4df 100644 --- a/validation-test/stdlib/OpenCLSDKOverlay.swift +++ b/validation-test/stdlib/OpenCLSDKOverlay.swift @@ -194,7 +194,7 @@ tests.test("clSetKernelArgsListAPPLE") { kernel!, 3, 0, MemoryLayout.size, inputPtr, 1, MemoryLayout.size, outputPtr, - 2, MemoryLayout._ofInstance(count).size, countPtr) + 2, MemoryLayout.size(ofValue: count), countPtr) } } } @@ -208,7 +208,7 @@ tests.test("clSetKernelArgsListAPPLE") { // Get the maximum work group size for executing the kernel on the device // - err = clGetKernelWorkGroupInfo(kernel, device_id, cl_kernel_work_group_info(CL_KERNEL_WORK_GROUP_SIZE), MemoryLayout._ofInstance(local).size, &local, nil) + err = clGetKernelWorkGroupInfo(kernel, device_id, cl_kernel_work_group_info(CL_KERNEL_WORK_GROUP_SIZE), MemoryLayout.size(ofValue: local), &local, nil) if (err != CL_SUCCESS) { print("Error: Failed to retrieve kernel work group info! \(err)") diff --git a/validation-test/stdlib/Set.swift b/validation-test/stdlib/Set.swift index 87cc89cef5bb6..56f30b9203513 100644 --- a/validation-test/stdlib/Set.swift +++ b/validation-test/stdlib/Set.swift @@ -325,9 +325,9 @@ SetTestSuite.test("AssociatedTypes") { SetTestSuite.test("sizeof") { var s = Set(["Hello", "world"]) #if arch(i386) || arch(arm) - expectEqual(4, MemoryLayout._ofInstance(s).size) + expectEqual(4, MemoryLayout.size(ofValue: s)) #else - expectEqual(8, MemoryLayout._ofInstance(s).size) + expectEqual(8, MemoryLayout.size(ofValue: s)) #endif } From 6f1999e25351c68919a9103c41e2f5606e6fb419 Mon Sep 17 00:00:00 2001 From: Xiaodi Wu Date: Fri, 5 Aug 2016 14:10:45 -0500 Subject: [PATCH 2/3] Restore tests for renamed functions --- test/1_stdlib/Renames.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/1_stdlib/Renames.swift b/test/1_stdlib/Renames.swift index 585e7d6d14350..01a15540af06d 100644 --- a/test/1_stdlib/Renames.swift +++ b/test/1_stdlib/Renames.swift @@ -284,6 +284,9 @@ func _MemoryLayout(t: T) { _ = sizeof(T.self) // expected-error {{'sizeof' is unavailable: use MemoryLayout.size instead.}} {{7-14=MemoryLayout<}} {{15-21=>.size}} {{none}} _ = alignof(T.self) // expected-error {{'alignof' is unavailable: use MemoryLayout.alignment instead.}} {{7-15=MemoryLayout<}} {{16-22=>.alignment}} {{none}} _ = strideof(T.self) // expected-error {{'strideof' is unavailable: use MemoryLayout.stride instead.}} {{7-16=MemoryLayout<}} {{17-23=>.stride}} {{none}} + _ = sizeofValue(T.self) // expected-error {{'sizeofValue' has been replaced by 'MemoryLayout.size(ofValue:)'}} {{7-18=MemoryLayout.size}} {{19-19=ofValue: }} {{none}} + _ = alignofValue(T.self) // expected-error {{'alignofValue' has been replaced by 'MemoryLayout.alignment(ofValue:)'}} {{7-19=MemoryLayout.alignment}} {{20-20=ofValue: }} {{none}} + _ = strideofValue(T.self) // expected-error {{'strideofValue' has been replaced by 'MemoryLayout.stride(ofValue:)'}} {{7-20=MemoryLayout.stride}} {{21-21=ofValue: }} {{none}} } func _Mirror() { From 2b51299754b415fa8fb53d6dc6b3d4dd583d333f Mon Sep 17 00:00:00 2001 From: Xiaodi Wu Date: Fri, 5 Aug 2016 14:13:51 -0500 Subject: [PATCH 3/3] Fix-up for restored tests for *ofValue(_:) --- test/1_stdlib/Renames.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/1_stdlib/Renames.swift b/test/1_stdlib/Renames.swift index 01a15540af06d..14b0a97f84e28 100644 --- a/test/1_stdlib/Renames.swift +++ b/test/1_stdlib/Renames.swift @@ -284,9 +284,9 @@ func _MemoryLayout(t: T) { _ = sizeof(T.self) // expected-error {{'sizeof' is unavailable: use MemoryLayout.size instead.}} {{7-14=MemoryLayout<}} {{15-21=>.size}} {{none}} _ = alignof(T.self) // expected-error {{'alignof' is unavailable: use MemoryLayout.alignment instead.}} {{7-15=MemoryLayout<}} {{16-22=>.alignment}} {{none}} _ = strideof(T.self) // expected-error {{'strideof' is unavailable: use MemoryLayout.stride instead.}} {{7-16=MemoryLayout<}} {{17-23=>.stride}} {{none}} - _ = sizeofValue(T.self) // expected-error {{'sizeofValue' has been replaced by 'MemoryLayout.size(ofValue:)'}} {{7-18=MemoryLayout.size}} {{19-19=ofValue: }} {{none}} - _ = alignofValue(T.self) // expected-error {{'alignofValue' has been replaced by 'MemoryLayout.alignment(ofValue:)'}} {{7-19=MemoryLayout.alignment}} {{20-20=ofValue: }} {{none}} - _ = strideofValue(T.self) // expected-error {{'strideofValue' has been replaced by 'MemoryLayout.stride(ofValue:)'}} {{7-20=MemoryLayout.stride}} {{21-21=ofValue: }} {{none}} + _ = sizeofValue(t) // expected-error {{'sizeofValue' has been replaced by 'MemoryLayout.size(ofValue:)'}} {{7-18=MemoryLayout.size}} {{19-19=ofValue: }} {{none}} + _ = alignofValue(t) // expected-error {{'alignofValue' has been replaced by 'MemoryLayout.alignment(ofValue:)'}} {{7-19=MemoryLayout.alignment}} {{20-20=ofValue: }} {{none}} + _ = strideofValue(t) // expected-error {{'strideofValue' has been replaced by 'MemoryLayout.stride(ofValue:)'}} {{7-20=MemoryLayout.stride}} {{21-21=ofValue: }} {{none}} } func _Mirror() {