Merge pull request #21905 from gottesmm/pr-e4aa69192289f84c89c0ffdec8febf6e15f0558f
[benchmark] Add autoreleasepools to the Codable tests to prevent "lea…
diff --git a/cmake/modules/AddSwift.cmake b/cmake/modules/AddSwift.cmake
index 8e51106..d1eac0d 100644
--- a/cmake/modules/AddSwift.cmake
+++ b/cmake/modules/AddSwift.cmake
@@ -755,9 +755,10 @@
endif()
endif()
- if (SWIFT_COMPILER_VERSION)
- if(${SWIFTLIB_SINGLE_SDK} IN_LIST SWIFT_APPLE_PLATFORMS)
- list(APPEND SWIFTLIB_SINGLE_LINK_FLAGS "-Xlinker" "-current_version" "-Xlinker" "${SWIFT_COMPILER_VERSION}" "-Xlinker" "-compatibility_version" "-Xlinker" "1")
+ if(${SWIFTLIB_SINGLE_SDK} IN_LIST SWIFT_APPLE_PLATFORMS)
+ list(APPEND SWIFTLIB_SINGLE_LINK_FLAGS "-Xlinker" "-compatibility_version" "-Xlinker" "1")
+ if (SWIFT_COMPILER_VERSION)
+ list(APPEND SWIFTLIB_SINGLE_LINK_FLAGS "-Xlinker" "-current_version" "-Xlinker" "${SWIFT_COMPILER_VERSION}" )
endif()
endif()
diff --git a/include/swift/Remote/MetadataReader.h b/include/swift/Remote/MetadataReader.h
index c8d9eb2..ffbe6cd 100644
--- a/include/swift/Remote/MetadataReader.h
+++ b/include/swift/Remote/MetadataReader.h
@@ -1113,7 +1113,7 @@
case MetadataKind::Tuple: {
auto numElementsAddress = address +
TargetTupleTypeMetadata<Runtime>::getOffsetToNumElements();
- uint32_t numElements;
+ StoredSize numElements;
if (!Reader->readInteger(RemoteAddress(numElementsAddress),
&numElements))
return nullptr;
diff --git a/lib/AST/Attr.cpp b/lib/AST/Attr.cpp
index 138b5dd..848f456 100644
--- a/lib/AST/Attr.cpp
+++ b/lib/AST/Attr.cpp
@@ -552,10 +552,10 @@
}
case DAK_ObjCRuntimeName: {
- Printer.printAttrName("@objc");
+ Printer.printAttrName("@_objcRuntimeName");
Printer << "(";
auto *attr = cast<ObjCRuntimeNameAttr>(this);
- Printer << "\"" << attr->Name << "\"";
+ Printer << attr->Name;
Printer << ")";
break;
}
diff --git a/lib/Migrator/overlay4.json b/lib/Migrator/overlay4.json
index d5fb336..6c2e805 100644
--- a/lib/Migrator/overlay4.json
+++ b/lib/Migrator/overlay4.json
@@ -1332,4 +1332,15 @@
"RightComment": "firstIndex",
"ModuleName": "Swift"
},
+ {
+ "DiffItemKind": "CommonDiffItem",
+ "NodeKind": "Function",
+ "NodeAnnotation": "Rename",
+ "ChildIndex": "0",
+ "LeftUsr": "s:SlsE5index5where5IndexQzSgSb7ElementQzKXE_tKF",
+ "LeftComment": "index",
+ "RightUsr": "",
+ "RightComment": "firstIndex",
+ "ModuleName": "Swift"
+ },
]
diff --git a/lib/Migrator/overlay42.json b/lib/Migrator/overlay42.json
index cc6d339..7498140 100644
--- a/lib/Migrator/overlay42.json
+++ b/lib/Migrator/overlay42.json
@@ -10,4 +10,15 @@
"RightComment": "firstIndex",
"ModuleName": "Swift"
},
+ {
+ "DiffItemKind": "CommonDiffItem",
+ "NodeKind": "Function",
+ "NodeAnnotation": "Rename",
+ "ChildIndex": "0",
+ "LeftUsr": "s:SlsE5index5where5IndexQzSgSb7ElementQzKXE_tKF",
+ "LeftComment": "index",
+ "RightUsr": "",
+ "RightComment": "firstIndex",
+ "ModuleName": "Swift"
+ },
]
diff --git a/lib/SILOptimizer/Transforms/PerformanceInliner.cpp b/lib/SILOptimizer/Transforms/PerformanceInliner.cpp
index c34a123..3c40d37 100644
--- a/lib/SILOptimizer/Transforms/PerformanceInliner.cpp
+++ b/lib/SILOptimizer/Transforms/PerformanceInliner.cpp
@@ -38,6 +38,10 @@
"sil-inline-generics", llvm::cl::init(false),
llvm::cl::desc("Enable inlining of generics"));
+llvm::cl::opt<bool>
+ EnableSILAgressiveInlining("sil-agressive-inline", llvm::cl::init(false),
+ llvm::cl::desc("Enable agressive inlining"));
+
//===----------------------------------------------------------------------===//
// Performance Inliner
//===----------------------------------------------------------------------===//
@@ -105,7 +109,7 @@
/// The benefit of inlining an exclusivity-containing callee.
/// The exclusivity needs to be: dynamic,
/// has no nested conflict and addresses known storage
- ExclusivityBenefit = RemovedCallBenefit + 125,
+ ExclusivityBenefit = RemovedCallBenefit + 10,
/// The benefit of inlining class methods with -Osize.
/// We only inline very small class methods with -Osize.
@@ -321,6 +325,10 @@
// the exclusivity heuristic or not. We can *only* do that
// if AllAccessesBeneficialToInline is true
int ExclusivityBenefitWeight = 0;
+ int ExclusivityBenefitBase = ExclusivityBenefit;
+ if (EnableSILAgressiveInlining) {
+ ExclusivityBenefitBase += 500;
+ }
SubstitutionMap CalleeSubstMap = AI.getSubstitutionMap();
@@ -422,7 +430,8 @@
if (BAI->hasNoNestedConflict() &&
(storage.isUniquelyIdentified() ||
storage.getKind() == AccessedStorage::Class)) {
- BlockW.updateBenefit(ExclusivityBenefitWeight, ExclusivityBenefit);
+ BlockW.updateBenefit(ExclusivityBenefitWeight,
+ ExclusivityBenefitBase);
} else {
AllAccessesBeneficialToInline = false;
}
diff --git a/lib/Serialization/Deserialization.cpp b/lib/Serialization/Deserialization.cpp
index 48a7811..00deb8a 100644
--- a/lib/Serialization/Deserialization.cpp
+++ b/lib/Serialization/Deserialization.cpp
@@ -1140,21 +1140,20 @@
return None;
}
-/// Determine whether the two modules are re-exported to the same module.
-static bool reExportedToSameModule(const ModuleDecl *fromModule,
- const ModuleDecl *toModule) {
+static bool isReExportedToModule(const ValueDecl *value,
+ const ModuleDecl *expectedModule) {
+ const DeclContext *valueDC = value->getDeclContext();
auto fromClangModule
- = dyn_cast<ClangModuleUnit>(fromModule->getFiles().front());
+ = dyn_cast<ClangModuleUnit>(valueDC->getModuleScopeContext());
if (!fromClangModule)
return false;
+ std::string exportedName = fromClangModule->getExportedModuleName();
auto toClangModule
- = dyn_cast<ClangModuleUnit>(toModule->getFiles().front());
- if (!toClangModule)
- return false;
-
- return fromClangModule->getExportedModuleName() ==
- toClangModule->getExportedModuleName();
+ = dyn_cast<ClangModuleUnit>(expectedModule->getFiles().front());
+ if (toClangModule)
+ return exportedName == toClangModule->getExportedModuleName();
+ return exportedName == expectedModule->getName().str();
}
/// Remove values from \p values that don't match the expected type or module.
@@ -1197,7 +1196,7 @@
// module to the original definition in a base module.
if (expectedModule && !value->hasClangNode() &&
value->getModuleContext() != expectedModule &&
- !reExportedToSameModule(value->getModuleContext(), expectedModule))
+ !isReExportedToModule(value, expectedModule))
return true;
// If we're expecting a member within a constrained extension with a
@@ -1357,6 +1356,7 @@
if (entry.Kind != llvm::BitstreamEntry::Record)
return Identifier();
+ scratch.clear();
unsigned recordID = DeclTypeCursor.readRecord(entry.ID, scratch,
&blobData);
switch (recordID) {
diff --git a/stdlib/public/Darwin/AppKit/NSGraphics.swift b/stdlib/public/Darwin/AppKit/NSGraphics.swift
index 6cc836c..f4e2a7c 100644
--- a/stdlib/public/Darwin/AppKit/NSGraphics.swift
+++ b/stdlib/public/Darwin/AppKit/NSGraphics.swift
@@ -181,7 +181,10 @@
}
extension NSAnimationEffect {
- private class _CompletionHandlerDelegate : NSObject {
+ // NOTE: older overlays called this class _CompletionHandlerDelegate.
+ // The two must coexist without a conflicting ObjC class name, so it
+ // was renamed. The old name must not be used in the new runtime.
+ private class __CompletionHandlerDelegate : NSObject {
var completionHandler: () -> Void = { }
@objc func animationEffectDidEnd(_ contextInfo: UnsafeMutableRawPointer?) {
completionHandler()
@@ -190,7 +193,7 @@
@available(swift 4)
public func show(centeredAt centerLocation: NSPoint, size: NSSize,
completionHandler: @escaping () -> Void = { }) {
- let delegate = _CompletionHandlerDelegate()
+ let delegate = __CompletionHandlerDelegate()
delegate.completionHandler = completionHandler
// Note that the delegate of `__NSShowAnimationEffect` is retained for the
// duration of the animation.
@@ -199,7 +202,7 @@
centerLocation,
size,
delegate,
- #selector(_CompletionHandlerDelegate.animationEffectDidEnd(_:)),
+ #selector(__CompletionHandlerDelegate.animationEffectDidEnd(_:)),
nil)
}
}
diff --git a/stdlib/public/Darwin/Dispatch/Block.swift b/stdlib/public/Darwin/Dispatch/Block.swift
index e3558e4..1f9d8b1 100644
--- a/stdlib/public/Darwin/Dispatch/Block.swift
+++ b/stdlib/public/Darwin/Dispatch/Block.swift
@@ -34,7 +34,12 @@
public static let enforceQoS = DispatchWorkItemFlags(rawValue: 0x20)
}
+// NOTE: older overlays had Dispatch.DispatchWorkItem as the ObjC name.
+// The two must coexist, so it was renamed. The old name must not be
+// used in the new runtime. _TtC8Dispatch17_DispatchWorkItem is the
+// mangled name for Dispatch._DispatchWorkItem.
@available(macOS 10.10, iOS 8.0, *)
+@_objcRuntimeName(_TtC8Dispatch17_DispatchWorkItem)
public class DispatchWorkItem {
internal var _block: _DispatchBlock
diff --git a/stdlib/public/Darwin/Foundation/CharacterSet.swift b/stdlib/public/Darwin/Foundation/CharacterSet.swift
index 3161d6a..68df36e 100644
--- a/stdlib/public/Darwin/Foundation/CharacterSet.swift
+++ b/stdlib/public/Darwin/Foundation/CharacterSet.swift
@@ -29,7 +29,10 @@
// MARK: -
-fileprivate final class _CharacterSetStorage : Hashable {
+// NOTE: older overlays called this class _CharacterSetStorage.
+// The two must coexist without a conflicting ObjC class name, so it
+// was renamed. The old name must not be used in the new runtime.
+fileprivate final class __CharacterSetStorage : Hashable {
fileprivate enum Backing {
case immutable(CFCharacterSet)
case mutable(CFMutableCharacterSet)
@@ -58,7 +61,7 @@
}
}
- fileprivate static func ==(lhs : _CharacterSetStorage, rhs : _CharacterSetStorage) -> Bool {
+ fileprivate static func ==(lhs : __CharacterSetStorage, rhs : __CharacterSetStorage) -> Bool {
switch (lhs._backing, rhs._backing) {
case (.immutable(let cs1), .immutable(let cs2)):
return CFEqual(cs1, cs2)
@@ -73,12 +76,12 @@
// MARK: -
- fileprivate func mutableCopy() -> _CharacterSetStorage {
+ fileprivate func mutableCopy() -> __CharacterSetStorage {
switch _backing {
case .immutable(let cs):
- return _CharacterSetStorage(mutableReference: CFCharacterSetCreateMutableCopy(nil, cs))
+ return __CharacterSetStorage(mutableReference: CFCharacterSetCreateMutableCopy(nil, cs))
case .mutable(let cs):
- return _CharacterSetStorage(mutableReference: CFCharacterSetCreateMutableCopy(nil, cs))
+ return __CharacterSetStorage(mutableReference: CFCharacterSetCreateMutableCopy(nil, cs))
}
}
@@ -223,7 +226,7 @@
// When the underlying collection does not have a method to return new CharacterSets with changes applied, so we will copy and apply here
- private static func _apply(_ lhs : _CharacterSetStorage, _ rhs : _CharacterSetStorage, _ f : (CFMutableCharacterSet, CFCharacterSet) -> ()) -> CharacterSet {
+ private static func _apply(_ lhs : __CharacterSetStorage, _ rhs : __CharacterSetStorage, _ f : (CFMutableCharacterSet, CFCharacterSet) -> ()) -> CharacterSet {
let copyOfMe : CFMutableCharacterSet
switch lhs._backing {
case .immutable(let cs):
@@ -239,10 +242,10 @@
f(copyOfMe, cs)
}
- return CharacterSet(_uncopiedStorage: _CharacterSetStorage(mutableReference: copyOfMe))
+ return CharacterSet(_uncopiedStorage: __CharacterSetStorage(mutableReference: copyOfMe))
}
- private func _applyMutation(_ other : _CharacterSetStorage, _ f : (CFMutableCharacterSet, CFCharacterSet) -> ()) {
+ private func _applyMutation(_ other : __CharacterSetStorage, _ f : (CFMutableCharacterSet, CFCharacterSet) -> ()) {
switch _backing {
case .immutable(let cs):
let r = CFCharacterSetCreateMutableCopy(nil, cs)!
@@ -267,47 +270,47 @@
fileprivate var inverted : CharacterSet {
switch _backing {
case .immutable(let cs):
- return CharacterSet(_uncopiedStorage: _CharacterSetStorage(immutableReference: CFCharacterSetCreateInvertedSet(nil, cs)))
+ return CharacterSet(_uncopiedStorage: __CharacterSetStorage(immutableReference: CFCharacterSetCreateInvertedSet(nil, cs)))
case .mutable(let cs):
// Even if input is mutable, the result is immutable
- return CharacterSet(_uncopiedStorage: _CharacterSetStorage(immutableReference: CFCharacterSetCreateInvertedSet(nil, cs)))
+ return CharacterSet(_uncopiedStorage: __CharacterSetStorage(immutableReference: CFCharacterSetCreateInvertedSet(nil, cs)))
}
}
- fileprivate func union(_ other: _CharacterSetStorage) -> CharacterSet {
- return _CharacterSetStorage._apply(self, other, CFCharacterSetUnion)
+ fileprivate func union(_ other: __CharacterSetStorage) -> CharacterSet {
+ return __CharacterSetStorage._apply(self, other, CFCharacterSetUnion)
}
- fileprivate func formUnion(_ other: _CharacterSetStorage) {
+ fileprivate func formUnion(_ other: __CharacterSetStorage) {
_applyMutation(other, CFCharacterSetUnion)
}
- fileprivate func intersection(_ other: _CharacterSetStorage) -> CharacterSet {
- return _CharacterSetStorage._apply(self, other, CFCharacterSetIntersect)
+ fileprivate func intersection(_ other: __CharacterSetStorage) -> CharacterSet {
+ return __CharacterSetStorage._apply(self, other, CFCharacterSetIntersect)
}
- fileprivate func formIntersection(_ other: _CharacterSetStorage) {
+ fileprivate func formIntersection(_ other: __CharacterSetStorage) {
_applyMutation(other, CFCharacterSetIntersect)
}
- fileprivate func subtracting(_ other: _CharacterSetStorage) -> CharacterSet {
+ fileprivate func subtracting(_ other: __CharacterSetStorage) -> CharacterSet {
return intersection(other.inverted._storage)
}
- fileprivate func subtract(_ other: _CharacterSetStorage) {
+ fileprivate func subtract(_ other: __CharacterSetStorage) {
_applyMutation(other.inverted._storage, CFCharacterSetIntersect)
}
- fileprivate func symmetricDifference(_ other: _CharacterSetStorage) -> CharacterSet {
+ fileprivate func symmetricDifference(_ other: __CharacterSetStorage) -> CharacterSet {
return union(other).subtracting(intersection(other))
}
- fileprivate func formSymmetricDifference(_ other: _CharacterSetStorage) {
+ fileprivate func formSymmetricDifference(_ other: __CharacterSetStorage) {
// This feels like cheating
_backing = symmetricDifference(other)._storage._backing
}
- fileprivate func isSuperset(of other: _CharacterSetStorage) -> Bool {
+ fileprivate func isSuperset(of other: __CharacterSetStorage) -> Bool {
switch _backing {
case .immutable(let cs):
switch other._backing {
@@ -363,35 +366,35 @@
public struct CharacterSet : ReferenceConvertible, Equatable, Hashable, SetAlgebra {
public typealias ReferenceType = NSCharacterSet
- fileprivate var _storage : _CharacterSetStorage
+ fileprivate var _storage : __CharacterSetStorage
// MARK: Init methods
/// Initialize an empty instance.
public init() {
// It's unlikely that we are creating an empty character set with no intention to mutate it
- _storage = _CharacterSetStorage(mutableReference: CFCharacterSetCreateMutable(nil))
+ _storage = __CharacterSetStorage(mutableReference: CFCharacterSetCreateMutable(nil))
}
/// Initialize with a range of integers.
///
/// It is the caller's responsibility to ensure that the values represent valid `Unicode.Scalar` values, if that is what is desired.
public init(charactersIn range: Range<Unicode.Scalar>) {
- _storage = _CharacterSetStorage(immutableReference: CFCharacterSetCreateWithCharactersInRange(nil, _utfRangeToCFRange(range)))
+ _storage = __CharacterSetStorage(immutableReference: CFCharacterSetCreateWithCharactersInRange(nil, _utfRangeToCFRange(range)))
}
/// Initialize with a closed range of integers.
///
/// It is the caller's responsibility to ensure that the values represent valid `Unicode.Scalar` values, if that is what is desired.
public init(charactersIn range: ClosedRange<Unicode.Scalar>) {
- _storage = _CharacterSetStorage(immutableReference: CFCharacterSetCreateWithCharactersInRange(nil, _utfRangeToCFRange(range)))
+ _storage = __CharacterSetStorage(immutableReference: CFCharacterSetCreateWithCharactersInRange(nil, _utfRangeToCFRange(range)))
}
/// Initialize with the characters in the given string.
///
/// - parameter string: The string content to inspect for characters.
public init(charactersIn string: __shared String) {
- _storage = _CharacterSetStorage(immutableReference: CFCharacterSetCreateWithCharactersInString(nil, string as CFString))
+ _storage = __CharacterSetStorage(immutableReference: CFCharacterSetCreateWithCharactersInString(nil, string as CFString))
}
/// Initialize with a bitmap representation.
@@ -399,7 +402,7 @@
/// This method is useful for creating a character set object with data from a file or other external data source.
/// - parameter data: The bitmap representation.
public init(bitmapRepresentation data: __shared Data) {
- _storage = _CharacterSetStorage(immutableReference: CFCharacterSetCreateWithBitmapRepresentation(nil, data as CFData))
+ _storage = __CharacterSetStorage(immutableReference: CFCharacterSetCreateWithBitmapRepresentation(nil, data as CFData))
}
/// Initialize with the contents of a file.
@@ -409,26 +412,26 @@
public init?(contentsOfFile file: __shared String) {
do {
let data = try Data(contentsOf: URL(fileURLWithPath: file), options: .mappedIfSafe)
- _storage = _CharacterSetStorage(immutableReference: CFCharacterSetCreateWithBitmapRepresentation(nil, data as CFData))
+ _storage = __CharacterSetStorage(immutableReference: CFCharacterSetCreateWithBitmapRepresentation(nil, data as CFData))
} catch {
return nil
}
}
fileprivate init(_bridged characterSet: __shared NSCharacterSet) {
- _storage = _CharacterSetStorage(immutableReference: characterSet.copy() as! CFCharacterSet)
+ _storage = __CharacterSetStorage(immutableReference: characterSet.copy() as! CFCharacterSet)
}
fileprivate init(_uncopiedImmutableReference characterSet: CFCharacterSet) {
- _storage = _CharacterSetStorage(immutableReference: characterSet)
+ _storage = __CharacterSetStorage(immutableReference: characterSet)
}
- fileprivate init(_uncopiedStorage : _CharacterSetStorage) {
+ fileprivate init(_uncopiedStorage : __CharacterSetStorage) {
_storage = _uncopiedStorage
}
fileprivate init(_builtIn: __shared CFCharacterSetPredefinedSet) {
- _storage = _CharacterSetStorage(immutableReference: CFCharacterSetGetPredefined(_builtIn))
+ _storage = __CharacterSetStorage(immutableReference: CFCharacterSetGetPredefined(_builtIn))
}
// MARK: Static functions
diff --git a/stdlib/public/Darwin/Foundation/Data.swift b/stdlib/public/Darwin/Foundation/Data.swift
index 699d334..725245b 100644
--- a/stdlib/public/Darwin/Foundation/Data.swift
+++ b/stdlib/public/Darwin/Foundation/Data.swift
@@ -64,8 +64,11 @@
// Underlying storage representation for medium and large data.
// Inlinability strategy: methods from here should not inline into InlineSlice or LargeSlice unless trivial.
+// NOTE: older overlays called this class _DataStorage. The two must
+// coexist without a conflicting ObjC class name, so it was renamed.
+// The old name must not be used in the new runtime.
@usableFromInline
-internal final class _DataStorage {
+internal final class __DataStorage {
@usableFromInline static let maxSize = Int.max >> 1
@usableFromInline static let vmOpsThreshold = NSPageSize() * 4
@@ -83,7 +86,7 @@
var dest = dest_
var source = source_
var num = num_
- if _DataStorage.vmOpsThreshold <= num && ((unsafeBitCast(source, to: Int.self) | Int(bitPattern: dest)) & (NSPageSize() - 1)) == 0 {
+ if __DataStorage.vmOpsThreshold <= num && ((unsafeBitCast(source, to: Int.self) | Int(bitPattern: dest)) & (NSPageSize() - 1)) == 0 {
let pages = NSRoundDownToMultipleOfPageSize(num)
NSCopyMemoryPages(source!, dest, pages)
source = source!.advanced(by: pages)
@@ -146,7 +149,7 @@
@inlinable // This is inlinable as trivially computable.
var isExternallyOwned: Bool {
- // all _DataStorages will have some sort of capacity, because empty cases hit the .empty enum _Representation
+ // all __DataStorages will have some sort of capacity, because empty cases hit the .empty enum _Representation
// anything with 0 capacity means that we have not allocated this pointer and concequently mutation is not ours to make.
return _capacity == 0
}
@@ -158,8 +161,8 @@
if newLength == 0 {
if isExternallyOwned {
let newCapacity = malloc_good_size(_length)
- let newBytes = _DataStorage.allocate(newCapacity, false)
- _DataStorage.move(newBytes!, _bytes!, _length)
+ let newBytes = __DataStorage.allocate(newCapacity, false)
+ __DataStorage.move(newBytes!, _bytes!, _length)
_freeBytes()
_bytes = newBytes
_capacity = newCapacity
@@ -167,9 +170,9 @@
}
} else if isExternallyOwned {
let newCapacity = malloc_good_size(newLength)
- let newBytes = _DataStorage.allocate(newCapacity, clear)
+ let newBytes = __DataStorage.allocate(newCapacity, clear)
if let bytes = _bytes {
- _DataStorage.move(newBytes!, bytes, _length)
+ __DataStorage.move(newBytes!, bytes, _length)
}
_freeBytes()
_bytes = newBytes
@@ -178,27 +181,27 @@
_needToZero = true
} else {
let cap = _capacity
- var additionalCapacity = (newLength >> (_DataStorage.vmOpsThreshold <= newLength ? 2 : 1))
+ var additionalCapacity = (newLength >> (__DataStorage.vmOpsThreshold <= newLength ? 2 : 1))
if Int.max - additionalCapacity < newLength {
additionalCapacity = 0
}
var newCapacity = malloc_good_size(Swift.max(cap, newLength + additionalCapacity))
let origLength = _length
- var allocateCleared = clear && _DataStorage.shouldAllocateCleared(newCapacity)
+ var allocateCleared = clear && __DataStorage.shouldAllocateCleared(newCapacity)
var newBytes: UnsafeMutableRawPointer? = nil
if _bytes == nil {
- newBytes = _DataStorage.allocate(newCapacity, allocateCleared)
+ newBytes = __DataStorage.allocate(newCapacity, allocateCleared)
if newBytes == nil {
/* Try again with minimum length */
- allocateCleared = clear && _DataStorage.shouldAllocateCleared(newLength)
- newBytes = _DataStorage.allocate(newLength, allocateCleared)
+ allocateCleared = clear && __DataStorage.shouldAllocateCleared(newLength)
+ newBytes = __DataStorage.allocate(newLength, allocateCleared)
}
} else {
let tryCalloc = (origLength == 0 || (newLength / origLength) >= 4)
if allocateCleared && tryCalloc {
- newBytes = _DataStorage.allocate(newCapacity, true)
+ newBytes = __DataStorage.allocate(newCapacity, true)
if let newBytes = newBytes {
- _DataStorage.move(newBytes, _bytes!, origLength)
+ __DataStorage.move(newBytes, _bytes!, origLength)
_freeBytes()
}
}
@@ -206,9 +209,9 @@
if newBytes == nil {
allocateCleared = false
if _deallocator != nil {
- newBytes = _DataStorage.allocate(newCapacity, true)
+ newBytes = __DataStorage.allocate(newCapacity, true)
if let newBytes = newBytes {
- _DataStorage.move(newBytes, _bytes!, origLength)
+ __DataStorage.move(newBytes, _bytes!, origLength)
_freeBytes()
}
} else {
@@ -218,11 +221,11 @@
/* Try again with minimum length */
if newBytes == nil {
newCapacity = malloc_good_size(newLength)
- allocateCleared = clear && _DataStorage.shouldAllocateCleared(newCapacity)
+ allocateCleared = clear && __DataStorage.shouldAllocateCleared(newCapacity)
if allocateCleared && tryCalloc {
- newBytes = _DataStorage.allocate(newCapacity, true)
+ newBytes = __DataStorage.allocate(newCapacity, true)
if let newBytes = newBytes {
- _DataStorage.move(newBytes, _bytes!, origLength)
+ __DataStorage.move(newBytes, _bytes!, origLength)
_freeBytes()
}
}
@@ -293,10 +296,10 @@
ensureUniqueBufferReference(growingTo: newLength, clear: false)
}
_length = newLength
- _DataStorage.move(_bytes!.advanced(by: origLength), bytes, length)
+ __DataStorage.move(_bytes!.advanced(by: origLength), bytes, length)
}
- @inlinable // This is @inlinable despite escaping the _DataStorage boundary layer because it is trivially computed.
+ @inlinable // This is @inlinable despite escaping the __DataStorage boundary layer because it is trivially computed.
func get(_ index: Int) -> UInt8 {
return _bytes!.advanced(by: index - _offset).assumingMemoryBound(to: UInt8.self).pointee
}
@@ -364,14 +367,14 @@
@usableFromInline // This is not @inlinable as a non-trivial, non-convenience initializer.
init(length: Int) {
- precondition(length < _DataStorage.maxSize)
+ precondition(length < __DataStorage.maxSize)
var capacity = (length < 1024 * 1024 * 1024) ? length + (length >> 2) : length
- if _DataStorage.vmOpsThreshold <= capacity {
+ if __DataStorage.vmOpsThreshold <= capacity {
capacity = NSRoundUpToMultipleOfPageSize(capacity)
}
- let clear = _DataStorage.shouldAllocateCleared(length)
- _bytes = _DataStorage.allocate(capacity, clear)!
+ let clear = __DataStorage.shouldAllocateCleared(length)
+ _bytes = __DataStorage.allocate(capacity, clear)!
_capacity = capacity
_needToZero = !clear
_length = 0
@@ -382,12 +385,12 @@
@usableFromInline // This is not @inlinable as a non-convience initializer.
init(capacity capacity_: Int = 0) {
var capacity = capacity_
- precondition(capacity < _DataStorage.maxSize)
- if _DataStorage.vmOpsThreshold <= capacity {
+ precondition(capacity < __DataStorage.maxSize)
+ if __DataStorage.vmOpsThreshold <= capacity {
capacity = NSRoundUpToMultipleOfPageSize(capacity)
}
_length = 0
- _bytes = _DataStorage.allocate(capacity, false)!
+ _bytes = __DataStorage.allocate(capacity, false)!
_capacity = capacity
_needToZero = true
_offset = 0
@@ -395,35 +398,35 @@
@usableFromInline // This is not @inlinable as a non-convience initializer.
init(bytes: UnsafeRawPointer?, length: Int) {
- precondition(length < _DataStorage.maxSize)
+ precondition(length < __DataStorage.maxSize)
_offset = 0
if length == 0 {
_capacity = 0
_length = 0
_needToZero = false
_bytes = nil
- } else if _DataStorage.vmOpsThreshold <= length {
+ } else if __DataStorage.vmOpsThreshold <= length {
_capacity = length
_length = length
_needToZero = true
- _bytes = _DataStorage.allocate(length, false)!
- _DataStorage.move(_bytes!, bytes, length)
+ _bytes = __DataStorage.allocate(length, false)!
+ __DataStorage.move(_bytes!, bytes, length)
} else {
var capacity = length
- if _DataStorage.vmOpsThreshold <= capacity {
+ if __DataStorage.vmOpsThreshold <= capacity {
capacity = NSRoundUpToMultipleOfPageSize(capacity)
}
_length = length
- _bytes = _DataStorage.allocate(capacity, false)!
+ _bytes = __DataStorage.allocate(capacity, false)!
_capacity = capacity
_needToZero = true
- _DataStorage.move(_bytes!, bytes, length)
+ __DataStorage.move(_bytes!, bytes, length)
}
}
@usableFromInline // This is not @inlinable as a non-convience initializer.
init(bytes: UnsafeMutableRawPointer?, length: Int, copy: Bool, deallocator: ((UnsafeMutableRawPointer, Int) -> Void)?, offset: Int) {
- precondition(length < _DataStorage.maxSize)
+ precondition(length < __DataStorage.maxSize)
_offset = offset
if length == 0 {
_capacity = 0
@@ -440,25 +443,25 @@
_needToZero = false
_bytes = bytes
_deallocator = deallocator
- } else if _DataStorage.vmOpsThreshold <= length {
+ } else if __DataStorage.vmOpsThreshold <= length {
_capacity = length
_length = length
_needToZero = true
- _bytes = _DataStorage.allocate(length, false)!
- _DataStorage.move(_bytes!, bytes, length)
+ _bytes = __DataStorage.allocate(length, false)!
+ __DataStorage.move(_bytes!, bytes, length)
if let dealloc = deallocator {
dealloc(bytes!, length)
}
} else {
var capacity = length
- if _DataStorage.vmOpsThreshold <= capacity {
+ if __DataStorage.vmOpsThreshold <= capacity {
capacity = NSRoundUpToMultipleOfPageSize(capacity)
}
_length = length
- _bytes = _DataStorage.allocate(capacity, false)!
+ _bytes = __DataStorage.allocate(capacity, false)!
_capacity = capacity
_needToZero = true
- _DataStorage.move(_bytes!, bytes, length)
+ __DataStorage.move(_bytes!, bytes, length)
if let dealloc = deallocator {
dealloc(bytes!, length)
}
@@ -517,9 +520,9 @@
_freeBytes()
}
- @inlinable // This is @inlinable despite escaping the _DataStorage boundary layer because it is trivially computed.
- func mutableCopy(_ range: Range<Int>) -> _DataStorage {
- return _DataStorage(bytes: _bytes?.advanced(by: range.lowerBound - _offset), length: range.upperBound - range.lowerBound, copy: true, deallocator: nil, offset: range.lowerBound)
+ @inlinable // This is @inlinable despite escaping the __DataStorage boundary layer because it is trivially computed.
+ func mutableCopy(_ range: Range<Int>) -> __DataStorage {
+ return __DataStorage(bytes: _bytes?.advanced(by: range.lowerBound - _offset), length: range.upperBound - range.lowerBound, copy: true, deallocator: nil, offset: range.lowerBound)
}
@inlinable // This is @inlinable despite escaping the _DataStorage boundary layer because it is generic and trivially computed.
@@ -541,14 +544,14 @@
}
}
-// NOTE: older runtimes called this _NSSwiftData. The two must
+// NOTE: older overlays called this _NSSwiftData. The two must
// coexist, so it was renamed. The old name must not be used in the new
// runtime.
internal class __NSSwiftData : NSData {
- var _backing: _DataStorage!
+ var _backing: __DataStorage!
var _range: Range<Data.Index>!
- convenience init(backing: _DataStorage, range: Range<Data.Index>) {
+ convenience init(backing: __DataStorage, range: Range<Data.Index>) {
self.init()
_backing = backing
_range = range
@@ -841,7 +844,7 @@
// ***WARNING***
// These ivars are specifically laid out so that they cause the enum _Representation to be 16 bytes on 64 bit platforms. This means we _MUST_ have the class type thing last
@usableFromInline var slice: Range<HalfInt>
- @usableFromInline var storage: _DataStorage
+ @usableFromInline var storage: __DataStorage
@inlinable // This is @inlinable as trivially computable.
static func canStore(count: Int) -> Bool {
@@ -851,32 +854,32 @@
@inlinable // This is @inlinable as a convenience initializer.
init(_ buffer: UnsafeRawBufferPointer) {
assert(buffer.count < HalfInt.max)
- self.init(_DataStorage(bytes: buffer.baseAddress, length: buffer.count), count: buffer.count)
+ self.init(__DataStorage(bytes: buffer.baseAddress, length: buffer.count), count: buffer.count)
}
@inlinable // This is @inlinable as a convenience initializer.
init(capacity: Int) {
assert(capacity < HalfInt.max)
- self.init(_DataStorage(capacity: capacity), count: 0)
+ self.init(__DataStorage(capacity: capacity), count: 0)
}
@inlinable // This is @inlinable as a convenience initializer.
init(count: Int) {
assert(count < HalfInt.max)
- self.init(_DataStorage(length: count), count: count)
+ self.init(__DataStorage(length: count), count: count)
}
@inlinable // This is @inlinable as a convenience initializer.
init(_ inline: InlineData) {
assert(inline.count < HalfInt.max)
- self.init(inline.withUnsafeBytes { return _DataStorage(bytes: $0.baseAddress, length: $0.count) }, count: inline.count)
+ self.init(inline.withUnsafeBytes { return __DataStorage(bytes: $0.baseAddress, length: $0.count) }, count: inline.count)
}
@inlinable // This is @inlinable as a convenience initializer.
init(_ inline: InlineData, range: Range<Int>) {
assert(range.lowerBound < HalfInt.max)
assert(range.upperBound < HalfInt.max)
- self.init(inline.withUnsafeBytes { return _DataStorage(bytes: $0.baseAddress, length: $0.count) }, range: range)
+ self.init(inline.withUnsafeBytes { return __DataStorage(bytes: $0.baseAddress, length: $0.count) }, range: range)
}
@inlinable // This is @inlinable as a convenience initializer.
@@ -894,14 +897,14 @@
}
@inlinable // This is @inlinable as a trivial initializer.
- init(_ storage: _DataStorage, count: Int) {
+ init(_ storage: __DataStorage, count: Int) {
assert(count < HalfInt.max)
self.storage = storage
slice = 0..<HalfInt(count)
}
@inlinable // This is @inlinable as a trivial initializer.
- init(_ storage: _DataStorage, range: Range<Int>) {
+ init(_ storage: __DataStorage, range: Range<Int>) {
assert(range.lowerBound < HalfInt.max)
assert(range.upperBound < HalfInt.max)
self.storage = storage
@@ -1087,26 +1090,26 @@
// ***WARNING***
// These ivars are specifically laid out so that they cause the enum _Representation to be 16 bytes on 64 bit platforms. This means we _MUST_ have the class type thing last
@usableFromInline var slice: RangeReference
- @usableFromInline var storage: _DataStorage
+ @usableFromInline var storage: __DataStorage
@inlinable // This is @inlinable as a convenience initializer.
init(_ buffer: UnsafeRawBufferPointer) {
- self.init(_DataStorage(bytes: buffer.baseAddress, length: buffer.count), count: buffer.count)
+ self.init(__DataStorage(bytes: buffer.baseAddress, length: buffer.count), count: buffer.count)
}
@inlinable // This is @inlinable as a convenience initializer.
init(capacity: Int) {
- self.init(_DataStorage(capacity: capacity), count: 0)
+ self.init(__DataStorage(capacity: capacity), count: 0)
}
@inlinable // This is @inlinable as a convenience initializer.
init(count: Int) {
- self.init(_DataStorage(length: count), count: count)
+ self.init(__DataStorage(length: count), count: count)
}
@inlinable // This is @inlinable as a convenience initializer.
init(_ inline: InlineData) {
- let storage = inline.withUnsafeBytes { return _DataStorage(bytes: $0.baseAddress, length: $0.count) }
+ let storage = inline.withUnsafeBytes { return __DataStorage(bytes: $0.baseAddress, length: $0.count) }
self.init(storage, count: inline.count)
}
@@ -1117,7 +1120,7 @@
}
@inlinable // This is @inlinable as a trivial initializer.
- init(_ storage: _DataStorage, count: Int) {
+ init(_ storage: __DataStorage, count: Int) {
self.storage = storage
self.slice = RangeReference(0..<count)
}
@@ -1286,7 +1289,7 @@
self = .inline(InlineData(buffer))
} else {
let count = buffer.count
- let storage = _DataStorage(bytes: UnsafeMutableRawPointer(mutating: buffer.baseAddress), length: count, copy: false, deallocator: { _, _ in
+ let storage = __DataStorage(bytes: UnsafeMutableRawPointer(mutating: buffer.baseAddress), length: count, copy: false, deallocator: { _, _ in
_fixLifetime(owner)
}, offset: 0)
if InlineSlice.canStore(count: count) {
@@ -1324,7 +1327,7 @@
}
@inlinable // This is @inlinable as a trivial initializer.
- init(_ storage: _DataStorage, count: Int) {
+ init(_ storage: __DataStorage, count: Int) {
if count == 0 {
self = .empty
} else if InlineData.canStore(count: count) {
@@ -1974,7 +1977,7 @@
deallocator._deallocator(bytes, count)
_representation = .empty
} else {
- _representation = _Representation(_DataStorage(bytes: bytes, length: count, copy: false, deallocator: whichDeallocator, offset: 0), count: count)
+ _representation = _Representation(__DataStorage(bytes: bytes, length: count, copy: false, deallocator: whichDeallocator, offset: 0), count: count)
}
}
@@ -2037,9 +2040,9 @@
let providesConcreteBacking = (reference as AnyObject)._providesConcreteBacking?() ?? false
#endif
if providesConcreteBacking {
- _representation = _Representation(_DataStorage(immutableReference: reference.copy() as! NSData, offset: 0), count: length)
+ _representation = _Representation(__DataStorage(immutableReference: reference.copy() as! NSData, offset: 0), count: length)
} else {
- _representation = _Representation(_DataStorage(customReference: reference.copy() as! NSData, offset: 0), count: length)
+ _representation = _Representation(__DataStorage(customReference: reference.copy() as! NSData, offset: 0), count: length)
}
}
diff --git a/stdlib/public/Darwin/Foundation/JSONEncoder.swift b/stdlib/public/Darwin/Foundation/JSONEncoder.swift
index 8f90826..e5811a0 100644
--- a/stdlib/public/Darwin/Foundation/JSONEncoder.swift
+++ b/stdlib/public/Darwin/Foundation/JSONEncoder.swift
@@ -51,6 +51,11 @@
//===----------------------------------------------------------------------===//
/// `JSONEncoder` facilitates the encoding of `Encodable` values into JSON.
+// NOTE: older overlays had Foundation.JSONEncoder as the ObjC name.
+// The two must coexist, so it was renamed. The old name must not be
+// used in the new runtime. _TtC10Foundation12_JSONEncoder is the
+// mangled name for Foundation._JSONEncoder.
+@_objcRuntimeName(_TtC10Foundation12_JSONEncoder)
open class JSONEncoder {
// MARK: Options
@@ -245,7 +250,7 @@
/// - throws: `EncodingError.invalidValue` if a non-conforming floating-point value is encountered during encoding, and the encoding strategy is `.throw`.
/// - throws: An error if any value throws an error during encoding.
open func encode<T : Encodable>(_ value: T) throws -> Data {
- let encoder = _JSONEncoder(options: self.options)
+ let encoder = __JSONEncoder(options: self.options)
guard let topLevel = try encoder.box_(value) else {
throw EncodingError.invalidValue(value,
@@ -273,9 +278,12 @@
}
}
-// MARK: - _JSONEncoder
+// MARK: - __JSONEncoder
-fileprivate class _JSONEncoder : Encoder {
+// NOTE: older overlays called this class _JSONEncoder.
+// The two must coexist without a conflicting ObjC class name, so it
+// was renamed. The old name must not be used in the new runtime.
+fileprivate class __JSONEncoder : Encoder {
// MARK: Properties
/// The encoder's storage.
@@ -405,7 +413,7 @@
// MARK: Properties
/// A reference to the encoder we're writing to.
- private let encoder: _JSONEncoder
+ private let encoder: __JSONEncoder
/// A reference to the container we're writing to.
private let container: NSMutableDictionary
@@ -416,7 +424,7 @@
// MARK: - Initialization
/// Initializes `self` with the given references.
- fileprivate init(referencing encoder: _JSONEncoder, codingPath: [CodingKey], wrapping container: NSMutableDictionary) {
+ fileprivate init(referencing encoder: __JSONEncoder, codingPath: [CodingKey], wrapping container: NSMutableDictionary) {
self.encoder = encoder
self.codingPath = codingPath
self.container = container
@@ -519,11 +527,11 @@
}
public mutating func superEncoder() -> Encoder {
- return _JSONReferencingEncoder(referencing: self.encoder, key: _JSONKey.super, convertedKey: _converted(_JSONKey.super), wrapping: self.container)
+ return __JSONReferencingEncoder(referencing: self.encoder, key: _JSONKey.super, convertedKey: _converted(_JSONKey.super), wrapping: self.container)
}
public mutating func superEncoder(forKey key: Key) -> Encoder {
- return _JSONReferencingEncoder(referencing: self.encoder, key: key, convertedKey: _converted(key), wrapping: self.container)
+ return __JSONReferencingEncoder(referencing: self.encoder, key: key, convertedKey: _converted(key), wrapping: self.container)
}
}
@@ -531,7 +539,7 @@
// MARK: Properties
/// A reference to the encoder we're writing to.
- private let encoder: _JSONEncoder
+ private let encoder: __JSONEncoder
/// A reference to the container we're writing to.
private let container: NSMutableArray
@@ -547,7 +555,7 @@
// MARK: - Initialization
/// Initializes `self` with the given references.
- fileprivate init(referencing encoder: _JSONEncoder, codingPath: [CodingKey], wrapping container: NSMutableArray) {
+ fileprivate init(referencing encoder: __JSONEncoder, codingPath: [CodingKey], wrapping container: NSMutableArray) {
self.encoder = encoder
self.codingPath = codingPath
self.container = container
@@ -610,11 +618,11 @@
}
public mutating func superEncoder() -> Encoder {
- return _JSONReferencingEncoder(referencing: self.encoder, at: self.container.count, wrapping: self.container)
+ return __JSONReferencingEncoder(referencing: self.encoder, at: self.container.count, wrapping: self.container)
}
}
-extension _JSONEncoder : SingleValueEncodingContainer {
+extension __JSONEncoder : SingleValueEncodingContainer {
// MARK: - SingleValueEncodingContainer Methods
fileprivate func assertCanEncodeNewValue() {
@@ -704,7 +712,7 @@
// MARK: - Concrete Value Representations
-extension _JSONEncoder {
+extension __JSONEncoder {
/// Returns the given value boxed in a container appropriate for pushing onto the container stack.
fileprivate func box(_ value: Bool) -> NSObject { return NSNumber(value: value) }
fileprivate func box(_ value: Int) -> NSObject { return NSNumber(value: value) }
@@ -902,7 +910,7 @@
return try self.box(value as! [String : Encodable])
}
- // The value should request a container from the _JSONEncoder.
+ // The value should request a container from the __JSONEncoder.
let depth = self.storage.count
do {
try value.encode(to: self)
@@ -924,11 +932,14 @@
}
}
-// MARK: - _JSONReferencingEncoder
+// MARK: - __JSONReferencingEncoder
-/// _JSONReferencingEncoder is a special subclass of _JSONEncoder which has its own storage, but references the contents of a different encoder.
+/// __JSONReferencingEncoder is a special subclass of __JSONEncoder which has its own storage, but references the contents of a different encoder.
/// It's used in superEncoder(), which returns a new encoder for encoding a superclass -- the lifetime of the encoder should not escape the scope it's created in, but it doesn't necessarily know when it's done being used (to write to the original container).
-fileprivate class _JSONReferencingEncoder : _JSONEncoder {
+// NOTE: older overlays called this class _JSONReferencingEncoder.
+// The two must coexist without a conflicting ObjC class name, so it
+// was renamed. The old name must not be used in the new runtime.
+fileprivate class __JSONReferencingEncoder : __JSONEncoder {
// MARK: Reference types.
/// The type of container we're referencing.
@@ -943,7 +954,7 @@
// MARK: - Properties
/// The encoder we're referencing.
- fileprivate let encoder: _JSONEncoder
+ fileprivate let encoder: __JSONEncoder
/// The container reference itself.
private let reference: Reference
@@ -951,7 +962,7 @@
// MARK: - Initialization
/// Initializes `self` by referencing the given array container in the given encoder.
- fileprivate init(referencing encoder: _JSONEncoder, at index: Int, wrapping array: NSMutableArray) {
+ fileprivate init(referencing encoder: __JSONEncoder, at index: Int, wrapping array: NSMutableArray) {
self.encoder = encoder
self.reference = .array(array, index)
super.init(options: encoder.options, codingPath: encoder.codingPath)
@@ -960,7 +971,7 @@
}
/// Initializes `self` by referencing the given dictionary container in the given encoder.
- fileprivate init(referencing encoder: _JSONEncoder,
+ fileprivate init(referencing encoder: __JSONEncoder,
key: CodingKey, convertedKey: __shared CodingKey, wrapping dictionary: NSMutableDictionary) {
self.encoder = encoder
self.reference = .dictionary(dictionary, convertedKey.stringValue)
@@ -1004,6 +1015,11 @@
//===----------------------------------------------------------------------===//
/// `JSONDecoder` facilitates the decoding of JSON into semantic `Decodable` types.
+// NOTE: older overlays had Foundation.JSONDecoder as the ObjC name.
+// The two must coexist, so it was renamed. The old name must not be
+// used in the new runtime. _TtC10Foundation12_JSONDecoder is the
+// mangled name for Foundation._JSONDecoder.
+@_objcRuntimeName(_TtC10Foundation12_JSONDecoder)
open class JSONDecoder {
// MARK: Options
diff --git a/stdlib/public/Darwin/Foundation/NSDictionary.swift b/stdlib/public/Darwin/Foundation/NSDictionary.swift
index 2b5b58b..90be2e4 100644
--- a/stdlib/public/Darwin/Foundation/NSDictionary.swift
+++ b/stdlib/public/Darwin/Foundation/NSDictionary.swift
@@ -348,6 +348,11 @@
extension NSDictionary : Sequence {
// FIXME: A class because we can't pass a struct with class fields through an
// [objc] interface without prematurely destroying the references.
+ // NOTE: older runtimes had
+ // _TtCE10FoundationCSo12NSDictionary8Iterator as the ObjC name. The
+ // two must coexist, so it was renamed. The old name must not be used
+ // in the new runtime.
+ @_objcRuntimeName(_TtCE10FoundationCSo12NSDictionary9_Iterator)
final public class Iterator : IteratorProtocol {
var _fastIterator: NSFastEnumerationIterator
var _dictionary: NSDictionary {
diff --git a/stdlib/public/Darwin/Foundation/NSError.swift b/stdlib/public/Darwin/Foundation/NSError.swift
index 6c4c212..57a2385 100644
--- a/stdlib/public/Darwin/Foundation/NSError.swift
+++ b/stdlib/public/Darwin/Foundation/NSError.swift
@@ -74,7 +74,10 @@
/// Class that implements the informal protocol
/// NSErrorRecoveryAttempting, which is used by NSError when it
/// attempts recovery from an error.
-class _NSErrorRecoveryAttempter {
+// NOTE: older overlays called this class _NSErrorRecoveryAttempter.
+// The two must coexist without a conflicting ObjC class name, so it
+// was renamed. The old name must not be used in the new runtime.
+class __NSErrorRecoveryAttempter {
@objc(attemptRecoveryFromError:optionIndex:delegate:didRecoverSelector:contextInfo:)
func attemptRecovery(fromError nsError: NSError,
optionIndex recoveryOptionIndex: Int,
@@ -252,7 +255,7 @@
case NSRecoveryAttempterErrorKey:
if error is RecoverableError {
- return _NSErrorRecoveryAttempter()
+ return __NSErrorRecoveryAttempter()
}
return nil
@@ -308,7 +311,7 @@
let recoverableError = error as? RecoverableError {
result[NSLocalizedRecoveryOptionsErrorKey] =
recoverableError.recoveryOptions
- result[NSRecoveryAttempterErrorKey] = _NSErrorRecoveryAttempter()
+ result[NSRecoveryAttempterErrorKey] = __NSErrorRecoveryAttempter()
}
return result as AnyObject
diff --git a/stdlib/public/Darwin/Foundation/PlistEncoder.swift b/stdlib/public/Darwin/Foundation/PlistEncoder.swift
index 151f275..8480c85 100644
--- a/stdlib/public/Darwin/Foundation/PlistEncoder.swift
+++ b/stdlib/public/Darwin/Foundation/PlistEncoder.swift
@@ -15,6 +15,11 @@
//===----------------------------------------------------------------------===//
/// `PropertyListEncoder` facilitates the encoding of `Encodable` values into property lists.
+// NOTE: older overlays had Foundation.PropertyListEncoder as the ObjC
+// name. The two must coexist, so it was renamed. The old name must not
+// be used in the new runtime. _TtC10Foundation20_PropertyListEncoder
+// is the mangled name for Foundation._PropertyListEncoder.
+@_objcRuntimeName(_TtC10Foundation20_PropertyListEncoder)
open class PropertyListEncoder {
// MARK: - Options
@@ -80,7 +85,7 @@
/// - throws: `EncodingError.invalidValue` if a non-conforming floating-point value is encountered during encoding, and the encoding strategy is `.throw`.
/// - throws: An error if any value throws an error during encoding.
internal func encodeToTopLevelContainer<Value : Encodable>(_ value: Value) throws -> Any {
- let encoder = _PlistEncoder(options: self.options)
+ let encoder = __PlistEncoder(options: self.options)
guard let topLevel = try encoder.box_(value) else {
throw EncodingError.invalidValue(value,
EncodingError.Context(codingPath: [],
@@ -91,9 +96,12 @@
}
}
-// MARK: - _PlistEncoder
+// MARK: - __PlistEncoder
-fileprivate class _PlistEncoder : Encoder {
+// NOTE: older overlays called this class _PlistEncoder. The two must
+// coexist without a conflicting ObjC class name, so it was renamed.
+// The old name must not be used in the new runtime.
+fileprivate class __PlistEncoder : Encoder {
// MARK: Properties
/// The encoder's storage.
@@ -223,7 +231,7 @@
// MARK: Properties
/// A reference to the encoder we're writing to.
- private let encoder: _PlistEncoder
+ private let encoder: __PlistEncoder
/// A reference to the container we're writing to.
private let container: NSMutableDictionary
@@ -234,7 +242,7 @@
// MARK: - Initialization
/// Initializes `self` with the given references.
- fileprivate init(referencing encoder: _PlistEncoder, codingPath: [CodingKey], wrapping container: NSMutableDictionary) {
+ fileprivate init(referencing encoder: __PlistEncoder, codingPath: [CodingKey], wrapping container: NSMutableDictionary) {
self.encoder = encoder
self.codingPath = codingPath
self.container = container
@@ -285,11 +293,11 @@
}
public mutating func superEncoder() -> Encoder {
- return _PlistReferencingEncoder(referencing: self.encoder, at: _PlistKey.super, wrapping: self.container)
+ return __PlistReferencingEncoder(referencing: self.encoder, at: _PlistKey.super, wrapping: self.container)
}
public mutating func superEncoder(forKey key: Key) -> Encoder {
- return _PlistReferencingEncoder(referencing: self.encoder, at: key, wrapping: self.container)
+ return __PlistReferencingEncoder(referencing: self.encoder, at: key, wrapping: self.container)
}
}
@@ -297,7 +305,7 @@
// MARK: Properties
/// A reference to the encoder we're writing to.
- private let encoder: _PlistEncoder
+ private let encoder: __PlistEncoder
/// A reference to the container we're writing to.
private let container: NSMutableArray
@@ -313,7 +321,7 @@
// MARK: - Initialization
/// Initializes `self` with the given references.
- fileprivate init(referencing encoder: _PlistEncoder, codingPath: [CodingKey], wrapping container: NSMutableArray) {
+ fileprivate init(referencing encoder: __PlistEncoder, codingPath: [CodingKey], wrapping container: NSMutableArray) {
self.encoder = encoder
self.codingPath = codingPath
self.container = container
@@ -364,11 +372,11 @@
}
public mutating func superEncoder() -> Encoder {
- return _PlistReferencingEncoder(referencing: self.encoder, at: self.container.count, wrapping: self.container)
+ return __PlistReferencingEncoder(referencing: self.encoder, at: self.container.count, wrapping: self.container)
}
}
-extension _PlistEncoder : SingleValueEncodingContainer {
+extension __PlistEncoder : SingleValueEncodingContainer {
// MARK: - SingleValueEncodingContainer Methods
private func assertCanEncodeNewValue() {
@@ -458,7 +466,7 @@
// MARK: - Concrete Value Representations
-extension _PlistEncoder {
+extension __PlistEncoder {
/// Returns the given value boxed in a container appropriate for pushing onto the container stack.
fileprivate func box(_ value: Bool) -> NSObject { return NSNumber(value: value) }
@@ -489,7 +497,7 @@
return (value as! NSData)
}
- // The value should request a container from the _PlistEncoder.
+ // The value should request a container from the __PlistEncoder.
let depth = self.storage.count
do {
try value.encode(to: self)
@@ -511,11 +519,14 @@
}
}
-// MARK: - _PlistReferencingEncoder
+// MARK: - __PlistReferencingEncoder
-/// _PlistReferencingEncoder is a special subclass of _PlistEncoder which has its own storage, but references the contents of a different encoder.
+/// __PlistReferencingEncoder is a special subclass of __PlistEncoder which has its own storage, but references the contents of a different encoder.
/// It's used in superEncoder(), which returns a new encoder for encoding a superclass -- the lifetime of the encoder should not escape the scope it's created in, but it doesn't necessarily know when it's done being used (to write to the original container).
-fileprivate class _PlistReferencingEncoder : _PlistEncoder {
+// NOTE: older overlays called this class _PlistReferencingEncoder.
+// The two must coexist without a conflicting ObjC class name, so it
+// was renamed. The old name must not be used in the new runtime.
+fileprivate class __PlistReferencingEncoder : __PlistEncoder {
// MARK: Reference types.
/// The type of container we're referencing.
@@ -530,7 +541,7 @@
// MARK: - Properties
/// The encoder we're referencing.
- private let encoder: _PlistEncoder
+ private let encoder: __PlistEncoder
/// The container reference itself.
private let reference: Reference
@@ -538,7 +549,7 @@
// MARK: - Initialization
/// Initializes `self` by referencing the given array container in the given encoder.
- fileprivate init(referencing encoder: _PlistEncoder, at index: Int, wrapping array: NSMutableArray) {
+ fileprivate init(referencing encoder: __PlistEncoder, at index: Int, wrapping array: NSMutableArray) {
self.encoder = encoder
self.reference = .array(array, index)
super.init(options: encoder.options, codingPath: encoder.codingPath)
@@ -547,7 +558,7 @@
}
/// Initializes `self` by referencing the given dictionary container in the given encoder.
- fileprivate init(referencing encoder: _PlistEncoder, at key: CodingKey, wrapping dictionary: NSMutableDictionary) {
+ fileprivate init(referencing encoder: __PlistEncoder, at key: CodingKey, wrapping dictionary: NSMutableDictionary) {
self.encoder = encoder
self.reference = .dictionary(dictionary, key.stringValue)
super.init(options: encoder.options, codingPath: encoder.codingPath)
@@ -590,6 +601,11 @@
//===----------------------------------------------------------------------===//
/// `PropertyListDecoder` facilitates the decoding of property list values into semantic `Decodable` types.
+// NOTE: older overlays had Foundation.PropertyListDecoder as the ObjC
+// name. The two must coexist, so it was renamed. The old name must not
+// be used in the new runtime. _TtC10Foundation20_PropertyListDecoder
+// is the mangled name for Foundation._PropertyListDecoder.
+@_objcRuntimeName(_TtC10Foundation20_PropertyListDecoder)
open class PropertyListDecoder {
// MARK: Options
@@ -652,7 +668,7 @@
/// - throws: `DecodingError.dataCorrupted` if values requested from the payload are corrupted, or if the given data is not a valid property list.
/// - throws: An error if any value throws an error during decoding.
internal func decode<T : Decodable>(_ type: T.Type, fromTopLevel container: Any) throws -> T {
- let decoder = _PlistDecoder(referencing: container, options: self.options)
+ let decoder = __PlistDecoder(referencing: container, options: self.options)
guard let value = try decoder.unbox(container, as: type) else {
throw DecodingError.valueNotFound(type, DecodingError.Context(codingPath: [], debugDescription: "The given data did not contain a top-level value."))
}
@@ -661,9 +677,12 @@
}
}
-// MARK: - _PlistDecoder
+// MARK: - __PlistDecoder
-fileprivate class _PlistDecoder : Decoder {
+// NOTE: older overlays called this class _PlistDecoder. The two must
+// coexist without a conflicting ObjC class name, so it was renamed.
+// The old name must not be used in the new runtime.
+fileprivate class __PlistDecoder : Decoder {
// MARK: Properties
/// The decoder's storage.
@@ -769,7 +788,7 @@
// MARK: Properties
/// A reference to the decoder we're reading from.
- private let decoder: _PlistDecoder
+ private let decoder: __PlistDecoder
/// A reference to the container we're reading from.
private let container: [String : Any]
@@ -780,7 +799,7 @@
// MARK: - Initialization
/// Initializes `self` by referencing the given decoder and container.
- fileprivate init(referencing decoder: _PlistDecoder, wrapping container: [String : Any]) {
+ fileprivate init(referencing decoder: __PlistDecoder, wrapping container: [String : Any]) {
self.decoder = decoder
self.container = container
self.codingPath = decoder.codingPath
@@ -1072,7 +1091,7 @@
defer { self.decoder.codingPath.removeLast() }
let value: Any = self.container[key.stringValue] ?? NSNull()
- return _PlistDecoder(referencing: value, at: self.decoder.codingPath, options: self.decoder.options)
+ return __PlistDecoder(referencing: value, at: self.decoder.codingPath, options: self.decoder.options)
}
public func superDecoder() throws -> Decoder {
@@ -1088,7 +1107,7 @@
// MARK: Properties
/// A reference to the decoder we're reading from.
- private let decoder: _PlistDecoder
+ private let decoder: __PlistDecoder
/// A reference to the container we're reading from.
private let container: [Any]
@@ -1102,7 +1121,7 @@
// MARK: - Initialization
/// Initializes `self` by referencing the given decoder and container.
- fileprivate init(referencing decoder: _PlistDecoder, wrapping container: [Any]) {
+ fileprivate init(referencing decoder: __PlistDecoder, wrapping container: [Any]) {
self.decoder = decoder
self.container = container
self.codingPath = decoder.codingPath
@@ -1434,11 +1453,11 @@
let value = self.container[self.currentIndex]
self.currentIndex += 1
- return _PlistDecoder(referencing: value, at: self.decoder.codingPath, options: self.decoder.options)
+ return __PlistDecoder(referencing: value, at: self.decoder.codingPath, options: self.decoder.options)
}
}
-extension _PlistDecoder : SingleValueDecodingContainer {
+extension __PlistDecoder : SingleValueDecodingContainer {
// MARK: SingleValueDecodingContainer Methods
private func expectNonNull<T>(_ type: T.Type) throws {
@@ -1533,7 +1552,7 @@
// MARK: - Concrete Value Representations
-extension _PlistDecoder {
+extension __PlistDecoder {
/// Returns the given value unboxed from a container.
fileprivate func unbox(_ value: Any, as type: Bool.Type) throws -> Bool? {
if let string = value as? String, string == _plistNull { return nil }
diff --git a/stdlib/public/Darwin/Network/NWConnection.swift b/stdlib/public/Darwin/Network/NWConnection.swift
index 64e2355..8834ed6 100644
--- a/stdlib/public/Darwin/Network/NWConnection.swift
+++ b/stdlib/public/Darwin/Network/NWConnection.swift
@@ -20,6 +20,11 @@
/// A connection handles establishment of any transport, security, or application-level protocols
/// required to transmit and receive user data. Multiple protocol instances may be attempted during
/// the establishment phase of the connection.
+// NOTE: older overlays had Network.NWConnection as the ObjC name.
+// The two must coexist, so it was renamed. The old name must not be
+// used in the new runtime. _TtC7Network13_NWConnection is the
+// mangled name for Network._NWConnection.
+@_objcRuntimeName(_TtC7Network13_NWConnection)
@available(macOS 10.14, iOS 12.0, watchOS 5.0, tvOS 12.0, *)
public final class NWConnection : CustomDebugStringConvertible {
@@ -306,6 +311,8 @@
/// Content Context controls options for how data is sent, and access for metadata to send or receive.
/// All properties of Content Context are valid for sending. For received Content Context, only the protocolMetadata
/// values will be set.
+ // Set the ObjC name of this class to be nested in the customized ObjC name of NWConnection.
+ @_objcRuntimeName(_TtCC7Network13_NWConnection14ContentContext)
public class ContentContext {
internal let nw: nw_content_context_t
diff --git a/stdlib/public/Darwin/Network/NWListener.swift b/stdlib/public/Darwin/Network/NWListener.swift
index e12a560..87e0e0a 100644
--- a/stdlib/public/Darwin/Network/NWListener.swift
+++ b/stdlib/public/Darwin/Network/NWListener.swift
@@ -22,6 +22,11 @@
/// accepted connections will represent multiplexed streams on a new or existing transport
/// binding.
+// NOTE: older overlays had Network.NWListener as the ObjC name.
+// The two must coexist, so it was renamed. The old name must not be
+// used in the new runtime. _TtC7Network11_NWListener is the
+// mangled name for Network._NWListener.
+@_objcRuntimeName(_TtC7Network11_NWListener)
@available(macOS 10.14, iOS 12.0, watchOS 5.0, tvOS 12.0, *)
public final class NWListener: CustomDebugStringConvertible {
public var debugDescription: String {
diff --git a/stdlib/public/Darwin/Network/NWParameters.swift b/stdlib/public/Darwin/Network/NWParameters.swift
index 9880f8b..face2df 100644
--- a/stdlib/public/Darwin/Network/NWParameters.swift
+++ b/stdlib/public/Darwin/Network/NWParameters.swift
@@ -16,6 +16,11 @@
/// endpoint requirements); preferences for data transfer and quality of service;
/// and the protocols to be used for a connection along with any protocol-specific
/// options.
+// NOTE: older overlays had Network.NWParameters as the ObjC name.
+// The two must coexist, so it was renamed. The old name must not be
+// used in the new runtime. _TtC7Network13_NWParameters is the
+// mangled name for Network._NWParameters.
+@_objcRuntimeName(_TtC7Network13_NWParameters)
@available(macOS 10.14, iOS 12.0, watchOS 5.0, tvOS 12.0, *)
public final class NWParameters : CustomDebugStringConvertible {
public var debugDescription: String {
@@ -422,6 +427,9 @@
/// transport-level protocol, and an optional internet-level protocol. If the internet-
/// level protocol is not specified, any available and applicable IP address family
/// may be used.
+ // Set the ObjC name of this class to be nested in the customized ObjC
+ // name of NWParameters.
+ @_objcRuntimeName(_TtCC7Network13_NWParameters13ProtocolStack)
public class ProtocolStack {
public var applicationProtocols: [NWProtocolOptions] {
set {
diff --git a/stdlib/public/Darwin/Network/NWPath.swift b/stdlib/public/Darwin/Network/NWPath.swift
index 437aa0c..000552a 100644
--- a/stdlib/public/Darwin/Network/NWPath.swift
+++ b/stdlib/public/Darwin/Network/NWPath.swift
@@ -225,6 +225,11 @@
/// The paths will watch the state of multiple interfaces, and allows the
/// application to enumerate the available interfaces for use in creating connections
/// or listeners bound to specific interfaces.
+// NOTE: older overlays had Network.NWPathMonitor as the ObjC name.
+// The two must coexist, so it was renamed. The old name must not be
+// used in the new runtime. _TtC7Network14_NWPathMonitor is the
+// mangled name for Network._NWPathMonitor.
+@_objcRuntimeName(_TtC7Network14_NWPathMonitor)
@available(macOS 10.14, iOS 12.0, watchOS 5.0, tvOS 12.0, *)
public final class NWPathMonitor {
diff --git a/stdlib/public/Darwin/Network/NWProtocol.swift b/stdlib/public/Darwin/Network/NWProtocol.swift
index 1512194..f05e30c 100644
--- a/stdlib/public/Darwin/Network/NWProtocol.swift
+++ b/stdlib/public/Darwin/Network/NWProtocol.swift
@@ -12,6 +12,11 @@
/// NWProtocolDefinition is an abstract superclass that represents the identifier of a
/// protocol that can be used with connections and listeners, such as TCP.
+// NOTE: older overlays had Network.NWProtocolDefinition as the ObjC name.
+// The two must coexist, so it was renamed. The old name must not be
+// used in the new runtime. _TtC7Network21_NWProtocolDefinition is the
+// mangled name for Network._NWProtocolDefinition.
+@_objcRuntimeName(_TtC7Network21_NWProtocolDefinition)
@available(macOS 10.14, iOS 12.0, watchOS 5.0, tvOS 12.0, *)
public class NWProtocolDefinition : Equatable, CustomDebugStringConvertible {
public static func == (lhs: NWProtocolDefinition, rhs: NWProtocolDefinition) -> Bool {
@@ -35,6 +40,11 @@
/// NWProtocolOptions is an abstract superclass that represents a configuration options
/// that can be used to add a protocol into an NWParameters.ProtocolStack. These options
/// configure the behavior of a protocol and cannot be changed after starting a connection.
+// NOTE: older overlays had Network.NWProtocolOptions as the ObjC name.
+// The two must coexist, so it was renamed. The old name must not be
+// used in the new runtime. _TtC7Network18_NWProtocolOptions is the
+// mangled name for Network._NWProtocolOptions.
+@_objcRuntimeName(_TtC7Network18_NWProtocolOptions)
@available(macOS 10.14, iOS 12.0, watchOS 5.0, tvOS 12.0, *)
public class NWProtocolOptions {
internal let nw: nw_protocol_options_t
@@ -50,6 +60,11 @@
/// specific to some content being sent; as well as to retrieve metadata specific to some
/// content that was received. Each protocol is responsible for defining its own accessor
/// functions to set and get metadata.
+// NOTE: older overlays had Network.NWProtocolMetadata as the ObjC name.
+// The two must coexist, so it was renamed. The old name must not be
+// used in the new runtime. _TtC7Network19_NWProtocolMetadata is the
+// mangled name for Network._NWProtocolMetadata.
+@_objcRuntimeName(_TtC7Network19_NWProtocolMetadata)
@available(macOS 10.14, iOS 12.0, watchOS 5.0, tvOS 12.0, *)
public class NWProtocolMetadata {
internal let nw: nw_protocol_metadata_t
@@ -60,6 +75,11 @@
}
/// NWProtocol is an abstract superclass to which protocol implementations conform.
+// NOTE: older overlays had Network.NWProtocol as the ObjC name.
+// The two must coexist, so it was renamed. The old name must not be
+// used in the new runtime. _TtC7Network11_NWProtocol is the
+// mangled name for Network._NWProtocol.
+@_objcRuntimeName(_TtC7Network11_NWProtocol)
@available(macOS 10.14, iOS 12.0, watchOS 5.0, tvOS 12.0, *)
public class NWProtocol {
diff --git a/stdlib/public/Darwin/Network/NWProtocolIP.swift b/stdlib/public/Darwin/Network/NWProtocolIP.swift
index 45c78f2..1e585bb 100644
--- a/stdlib/public/Darwin/Network/NWProtocolIP.swift
+++ b/stdlib/public/Darwin/Network/NWProtocolIP.swift
@@ -10,12 +10,20 @@
//
//===----------------------------------------------------------------------===//
+// NOTE: older overlays had Network.NWProtocolIP as the ObjC name.
+// The two must coexist, so it was renamed. The old name must not be
+// used in the new runtime. _TtC7Network13_NWProtocolIP is the
+// mangled name for Network._NWProtocolIP.
+@_objcRuntimeName(_TtC7Network13_NWProtocolIP)
@available(macOS 10.14, iOS 12.0, watchOS 5.0, tvOS 12.0, *)
public class NWProtocolIP : NWProtocol {
public static let definition: NWProtocolDefinition = {
NWProtocolDefinition(nw_protocol_copy_ip_definition(), "ip")
}()
+ // Set the ObjC name of this class to be nested in the customized ObjC
+ // name of NWProtocolIP.
+ @_objcRuntimeName(_TtCC7Network13_NWProtocolIP7Options)
public class Options : NWProtocolOptions {
public enum Version {
/// Allow any IP version
@@ -167,6 +175,9 @@
}
/// IP Metadata can be sent or received as part of ContentContext
+ // Set the ObjC name of this class to be nested in the customized ObjC
+ // name of NWProtocolIP.
+ @_objcRuntimeName(_TtCC7Network13_NWProtocolIP8Metadata)
public class Metadata: NWProtocolMetadata {
/// Set ECN flags to be sent on a packet, or get ECN flags
/// received on a packet. These flags will not take effect
diff --git a/stdlib/public/Darwin/Network/NWProtocolTCP.swift b/stdlib/public/Darwin/Network/NWProtocolTCP.swift
index d85d5d7..f7968eb 100644
--- a/stdlib/public/Darwin/Network/NWProtocolTCP.swift
+++ b/stdlib/public/Darwin/Network/NWProtocolTCP.swift
@@ -10,12 +10,20 @@
//
//===----------------------------------------------------------------------===//
+// NOTE: older overlays had Network.NWProtocolTCP as the ObjC name.
+// The two must coexist, so it was renamed. The old name must not be
+// used in the new runtime. _TtC7Network14_NWProtocolTCP is the
+// mangled name for Network._NWProtocolTCP.
+@_objcRuntimeName(_TtC7Network14_NWProtocolTCP)
@available(macOS 10.14, iOS 12.0, watchOS 5.0, tvOS 12.0, *)
public class NWProtocolTCP : NWProtocol {
public static let definition: NWProtocolDefinition = {
NWProtocolDefinition(nw_protocol_copy_tcp_definition(), "tcp")
}()
+ // Set the ObjC name of this class to be nested in the customized ObjC
+ // name of NWProtocolTCP.
+ @_objcRuntimeName(_TtCC7Network14_NWProtocolTCP7Options)
public class Options : NWProtocolOptions {
private var _noDelay: Bool = false
@@ -244,6 +252,9 @@
/// Access TCP metadata using NWConnection.metadata(protocolDefinition: NWProtocolTCP.definition)
/// or in received ContentContext
+ // Set the ObjC name of this class to be nested in the customized ObjC
+ // name of NWProtocolTCP.
+ @_objcRuntimeName(_TtCC7Network14_NWProtocolTCP8Metadata)
public class Metadata: NWProtocolMetadata {
override internal init(_ nw: nw_protocol_metadata_t) {
super.init(nw)
diff --git a/stdlib/public/Darwin/Network/NWProtocolTLS.swift b/stdlib/public/Darwin/Network/NWProtocolTLS.swift
index beb21fa..0522d8d 100644
--- a/stdlib/public/Darwin/Network/NWProtocolTLS.swift
+++ b/stdlib/public/Darwin/Network/NWProtocolTLS.swift
@@ -10,12 +10,20 @@
//
//===----------------------------------------------------------------------===//
+// NOTE: older overlays had Network.NWProtocolTLS as the ObjC name.
+// The two must coexist, so it was renamed. The old name must not be
+// used in the new runtime. _TtC7Network14_NWProtocolTLS is the
+// mangled name for Network._NWProtocolTLS.
+@_objcRuntimeName(_TtC7Network14_NWProtocolTLS)
@available(macOS 10.14, iOS 12.0, watchOS 5.0, tvOS 12.0, *)
public class NWProtocolTLS : NWProtocol {
public static let definition: NWProtocolDefinition = {
NWProtocolDefinition(nw_protocol_copy_tls_definition(), "tls")
}()
+ // Set the ObjC name of this class to be nested in the customized ObjC
+ // name of NWProtocolTLS.
+ @_objcRuntimeName(_TtCC7Network14_NWProtocolTLS7Options)
public class Options : NWProtocolOptions {
/// Access the sec_protocol_options_t for a given network protocol
/// options instance. See <Security/SecProtocolOptions.h> for functions
@@ -36,6 +44,9 @@
/// Access TLS metadata using NWConnection.metadata(protocolDefinition: NWProtocolTLS.definition)
/// or in received ContentContext
+ // Set the ObjC name of this class to be nested in the customized ObjC
+ // name of NWNWProtocolTLSProtocolIP.
+ @_objcRuntimeName(_TtCC7Network14_NWProtocolTLS8Metadata)
public class Metadata: NWProtocolMetadata {
/// Access the sec_protocol_metadata_t for a given network protocol
/// metadata instance. See <Security/SecProtocolMetadata.h> for functions
diff --git a/stdlib/public/Darwin/Network/NWProtocolUDP.swift b/stdlib/public/Darwin/Network/NWProtocolUDP.swift
index fe77087..7f345d7 100644
--- a/stdlib/public/Darwin/Network/NWProtocolUDP.swift
+++ b/stdlib/public/Darwin/Network/NWProtocolUDP.swift
@@ -10,12 +10,20 @@
//
//===----------------------------------------------------------------------===//
+// NOTE: older overlays had Network.NWProtocolUDP as the ObjC name.
+// The two must coexist, so it was renamed. The old name must not be
+// used in the new runtime. _TtC7Network14_NWProtocolUDP is the
+// mangled name for Network._NWProtocolUDP.
+@_objcRuntimeName(_TtC7Network14_NWProtocolUDP)
@available(macOS 10.14, iOS 12.0, watchOS 5.0, tvOS 12.0, *)
public class NWProtocolUDP : NWProtocol {
public static let definition: NWProtocolDefinition = {
NWProtocolDefinition(nw_protocol_copy_udp_definition(), "udp")
}()
+ // Set the ObjC name of this class to be nested in the customized ObjC
+ // name of NWProtocolUDP.
+ @_objcRuntimeName(_TtCC7Network14_NWProtocolUDP7Options)
public class Options : NWProtocolOptions {
private var _preferNoChecksum: Bool = false
@@ -42,7 +50,10 @@
}
}
- public class Metadata: NWProtocolMetadata {
+ // Set the ObjC name of this class to be nested in the customized ObjC
+ // name of NWProtocolUDP.
+ @_objcRuntimeName(_TtCC7Network14_NWProtocolUDP8Metadata)
+ public class Metadata: NWProtocolMetadata {
override internal init(_ nw: nw_protocol_metadata_t) {
super.init(nw)
}
diff --git a/stdlib/public/Darwin/SpriteKit/SpriteKit.swift b/stdlib/public/Darwin/SpriteKit/SpriteKit.swift
index aa6fd22..6b78367 100644
--- a/stdlib/public/Darwin/SpriteKit/SpriteKit.swift
+++ b/stdlib/public/Darwin/SpriteKit/SpriteKit.swift
@@ -25,7 +25,7 @@
// since that method only exists in a private header in SpriteKit, the lookup
// mechanism by default fails to accept it as a valid AnyObject call
//
-// NOTE: older runtimes called this _SpriteKitMethodProvider. The two must
+// NOTE: older overlays called this _SpriteKitMethodProvider. The two must
// coexist, so it was renamed. The old name must not be used in the new
// runtime.
@objc class __SpriteKitMethodProvider : NSObject {
diff --git a/stdlib/public/core/BridgingBuffer.swift b/stdlib/public/core/BridgingBuffer.swift
index 34d0c3e..c3d0613 100644
--- a/stdlib/public/core/BridgingBuffer.swift
+++ b/stdlib/public/core/BridgingBuffer.swift
@@ -15,7 +15,10 @@
internal var count: Int
}
-internal final class _BridgingBufferStorage
+// NOTE: older runtimes called this class _BridgingBufferStorage.
+// The two must coexist without a conflicting ObjC class name, so it
+// was renamed. The old name must not be used in the new runtime.
+internal final class __BridgingBufferStorage
: ManagedBuffer<_BridgingBufferHeader, AnyObject> {
}
@@ -26,7 +29,7 @@
where Header == _BridgingBufferHeader, Element == AnyObject {
internal init(_ count: Int) {
self.init(
- _uncheckedBufferClass: _BridgingBufferStorage.self,
+ _uncheckedBufferClass: __BridgingBufferStorage.self,
minimumCapacity: count)
self.withUnsafeMutablePointerToHeader {
$0.initialize(to: Header(count))
diff --git a/stdlib/public/core/Dictionary.swift b/stdlib/public/core/Dictionary.swift
index 9f0a733..b1b8bd1 100644
--- a/stdlib/public/core/Dictionary.swift
+++ b/stdlib/public/core/Dictionary.swift
@@ -40,7 +40,7 @@
// /
// |
// V
-// class _RawDictionaryStorage
+// class __RawDictionaryStorage
// +-----------------------------------------------------------+
// | <isa> |
// | <refcount> |
@@ -62,7 +62,7 @@
// +----------------------------------------------+
// | enum Dictionary<K,V>._Variant |
// | +----------------------------------------+ |
-// | | [ struct _CocoaDictionary | |
+// | | [ struct __CocoaDictionary | |
// | +---|------------------------------------+ |
// +----/-----------------------------------------+
// /
@@ -75,9 +75,9 @@
// +--------------+
// ^
// |
-// \ struct _CocoaDictionary.Index
+// \ struct __CocoaDictionary.Index
// +--|------------------------------------+
-// | * base: _CocoaDictionary |
+// | * base: __CocoaDictionary |
// | allKeys: array of all keys |
// | currentKeyIndex: index into allKeys |
// +---------------------------------------+
@@ -87,8 +87,8 @@
// ---------------------------
//
// The native backing store is represented by three different classes:
-// * `_RawDictionaryStorage`
-// * `_EmptyDictionarySingleton` (extends Raw)
+// * `__RawDictionaryStorage`
+// * `__EmptyDictionarySingleton` (extends Raw)
// * `_DictionaryStorage<K: Hashable, V>` (extends Raw)
//
// (Hereafter `Raw`, `Empty`, and `Storage`, respectively)
@@ -401,7 +401,7 @@
#if _runtime(_ObjC)
@inlinable
- internal init(_cocoa: __owned _CocoaDictionary) {
+ internal init(_cocoa: __owned __CocoaDictionary) {
_variant = _Variant(cocoa: _cocoa)
}
@@ -422,7 +422,7 @@
Dictionary can be backed by NSDictionary buffer only when both Key \
and Value are bridged verbatim to Objective-C
""")
- self.init(_cocoa: _CocoaDictionary(_immutableCocoaDictionary))
+ self.init(_cocoa: __CocoaDictionary(_immutableCocoaDictionary))
}
#endif
@@ -1744,7 +1744,7 @@
internal enum _Variant {
case native(_HashTable.Index)
#if _runtime(_ObjC)
- case cocoa(_CocoaDictionary.Index)
+ case cocoa(__CocoaDictionary.Index)
#endif
}
@@ -1766,7 +1766,7 @@
#if _runtime(_ObjC)
@inlinable
@inline(__always)
- internal init(_cocoa index: __owned _CocoaDictionary.Index) {
+ internal init(_cocoa index: __owned __CocoaDictionary.Index) {
self.init(_variant: .cocoa(index))
}
#endif
@@ -1824,7 +1824,7 @@
#if _runtime(_ObjC)
@usableFromInline
- internal var _asCocoa: _CocoaDictionary.Index {
+ internal var _asCocoa: __CocoaDictionary.Index {
@_transparent
get {
switch _variant {
@@ -1925,7 +1925,7 @@
internal enum _Variant {
case native(_NativeDictionary<Key, Value>.Iterator)
#if _runtime(_ObjC)
- case cocoa(_CocoaDictionary.Iterator)
+ case cocoa(__CocoaDictionary.Iterator)
#endif
}
@@ -1944,7 +1944,7 @@
#if _runtime(_ObjC)
@inlinable
- internal init(_cocoa: __owned _CocoaDictionary.Iterator) {
+ internal init(_cocoa: __owned __CocoaDictionary.Iterator) {
self.init(_variant: .cocoa(_cocoa))
}
#endif
@@ -1998,7 +1998,7 @@
#if _runtime(_ObjC)
@usableFromInline @_transparent
- internal var _asCocoa: _CocoaDictionary.Iterator {
+ internal var _asCocoa: __CocoaDictionary.Iterator {
get {
switch _variant {
case .native:
diff --git a/stdlib/public/core/DictionaryBridging.swift b/stdlib/public/core/DictionaryBridging.swift
index f22e00d..23d753a 100644
--- a/stdlib/public/core/DictionaryBridging.swift
+++ b/stdlib/public/core/DictionaryBridging.swift
@@ -35,8 +35,8 @@
// Temporary var for SOME type safety.
let nsDictionary: _NSDictionaryCore
- if _storage === _RawDictionaryStorage.empty || count == 0 {
- nsDictionary = _RawDictionaryStorage.empty
+ if _storage === __RawDictionaryStorage.empty || count == 0 {
+ nsDictionary = __RawDictionaryStorage.empty
} else if _isBridgedVerbatimToObjectiveC(Key.self),
_isBridgedVerbatimToObjectiveC(Value.self) {
nsDictionary = unsafeDowncast(
@@ -56,7 +56,7 @@
: __SwiftNativeNSEnumerator, _NSEnumerator {
@nonobjc internal var base: _NativeDictionary<Key, Value>
- @nonobjc internal var bridgedKeys: _BridgingHashBuffer?
+ @nonobjc internal var bridgedKeys: __BridgingHashBuffer?
@nonobjc internal var nextBucket: _NativeDictionary<Key, Value>.Bucket
@nonobjc internal var endBucket: _NativeDictionary<Key, Value>.Bucket
@@ -186,41 +186,41 @@
/// The buffer for bridged keys, if present.
@nonobjc
- private var _bridgedKeys: _BridgingHashBuffer? {
+ private var _bridgedKeys: __BridgingHashBuffer? {
guard let ref = _stdlib_atomicLoadARCRef(object: _bridgedKeysPtr) else {
return nil
}
- return unsafeDowncast(ref, to: _BridgingHashBuffer.self)
+ return unsafeDowncast(ref, to: __BridgingHashBuffer.self)
}
/// The buffer for bridged values, if present.
@nonobjc
- private var _bridgedValues: _BridgingHashBuffer? {
+ private var _bridgedValues: __BridgingHashBuffer? {
guard let ref = _stdlib_atomicLoadARCRef(object: _bridgedValuesPtr) else {
return nil
}
- return unsafeDowncast(ref, to: _BridgingHashBuffer.self)
+ return unsafeDowncast(ref, to: __BridgingHashBuffer.self)
}
/// Attach a buffer for bridged Dictionary keys.
@nonobjc
- private func _initializeBridgedKeys(_ storage: _BridgingHashBuffer) {
+ private func _initializeBridgedKeys(_ storage: __BridgingHashBuffer) {
_stdlib_atomicInitializeARCRef(object: _bridgedKeysPtr, desired: storage)
}
/// Attach a buffer for bridged Dictionary values.
@nonobjc
- private func _initializeBridgedValues(_ storage: _BridgingHashBuffer) {
+ private func _initializeBridgedValues(_ storage: __BridgingHashBuffer) {
_stdlib_atomicInitializeARCRef(object: _bridgedValuesPtr, desired: storage)
}
@nonobjc
- internal func bridgeKeys() -> _BridgingHashBuffer? {
+ internal func bridgeKeys() -> __BridgingHashBuffer? {
if _isBridgedVerbatimToObjectiveC(Key.self) { return nil }
if let bridgedKeys = _bridgedKeys { return bridgedKeys }
// Allocate and initialize heap storage for bridged keys.
- let bridged = _BridgingHashBuffer.allocate(
+ let bridged = __BridgingHashBuffer.allocate(
owner: native._storage,
hashTable: native.hashTable)
for bucket in native.hashTable {
@@ -234,12 +234,12 @@
}
@nonobjc
- internal func bridgeValues() -> _BridgingHashBuffer? {
+ internal func bridgeValues() -> __BridgingHashBuffer? {
if _isBridgedVerbatimToObjectiveC(Value.self) { return nil }
if let bridgedValues = _bridgedValues { return bridgedValues }
// Allocate and initialize heap storage for bridged values.
- let bridged = _BridgingHashBuffer.allocate(
+ let bridged = __BridgingHashBuffer.allocate(
owner: native._storage,
hashTable: native.hashTable)
for bucket in native.hashTable {
@@ -263,7 +263,7 @@
@inline(__always)
private func _key(
at bucket: Bucket,
- bridgedKeys: _BridgingHashBuffer?
+ bridgedKeys: __BridgingHashBuffer?
) -> AnyObject {
if let bridgedKeys = bridgedKeys {
return bridgedKeys[bucket]
@@ -274,7 +274,7 @@
@inline(__always)
private func _value(
at bucket: Bucket,
- bridgedValues: _BridgingHashBuffer?
+ bridgedValues: __BridgingHashBuffer?
) -> AnyObject {
if let bridgedValues = bridgedValues {
return bridgedValues[bucket]
@@ -417,9 +417,13 @@
}
}
+// NOTE: older runtimes called this struct _CocoaDictionary. The two
+// must coexist without conflicting ObjC class names from the nested
+// classes, so it was renamed. The old names must not be used in the new
+// runtime.
@usableFromInline
@_fixed_layout
-internal struct _CocoaDictionary {
+internal struct __CocoaDictionary {
@usableFromInline
internal let object: AnyObject
@@ -429,14 +433,14 @@
}
}
-extension _CocoaDictionary {
+extension __CocoaDictionary {
@usableFromInline
- internal func isEqual(to other: _CocoaDictionary) -> Bool {
+ internal func isEqual(to other: __CocoaDictionary) -> Bool {
return _stdlib_NSObject_isEqual(self.object, other.object)
}
}
-extension _CocoaDictionary: _DictionaryBuffer {
+extension __CocoaDictionary: _DictionaryBuffer {
@usableFromInline
internal typealias Key = AnyObject
@usableFromInline
@@ -545,7 +549,7 @@
}
}
-extension _CocoaDictionary {
+extension __CocoaDictionary {
@inlinable
internal func mapValues<Key: Hashable, Value, T>(
_ transform: (Value) throws -> T
@@ -560,7 +564,7 @@
}
}
-extension _CocoaDictionary {
+extension __CocoaDictionary {
@_fixed_layout
@usableFromInline
internal struct Index {
@@ -582,7 +586,7 @@
}
}
-extension _CocoaDictionary.Index {
+extension __CocoaDictionary.Index {
// FIXME(cocoa-index): Try using an NSEnumerator to speed this up.
internal class Storage {
// Assumption: we rely on NSDictionary.getObjects when being
@@ -592,7 +596,7 @@
/// A reference to the NSDictionary, which owns members in `allObjects`,
/// or `allKeys`, for NSSet and NSDictionary respectively.
- internal let base: _CocoaDictionary
+ internal let base: __CocoaDictionary
// FIXME: swift-3-indexing-model: try to remove the cocoa reference, but
// make sure that we have a safety check for accessing `allKeys`. Maybe
// move both into the dictionary/set itself.
@@ -601,7 +605,7 @@
internal var allKeys: _BridgingBuffer
internal init(
- _ base: __owned _CocoaDictionary,
+ _ base: __owned __CocoaDictionary,
_ allKeys: __owned _BridgingBuffer
) {
self.base = base
@@ -610,7 +614,7 @@
}
}
-extension _CocoaDictionary.Index {
+extension __CocoaDictionary.Index {
@usableFromInline
internal var handleBitPattern: UInt {
@_effects(readonly)
@@ -620,7 +624,7 @@
}
@usableFromInline
- internal var dictionary: _CocoaDictionary {
+ internal var dictionary: __CocoaDictionary {
@_effects(releasenone)
get {
return storage.base
@@ -628,7 +632,7 @@
}
}
-extension _CocoaDictionary.Index {
+extension __CocoaDictionary.Index {
@usableFromInline // FIXME(cocoa-index): Make inlinable
@nonobjc
internal var key: AnyObject {
@@ -650,12 +654,12 @@
}
}
-extension _CocoaDictionary.Index: Equatable {
+extension __CocoaDictionary.Index: Equatable {
@usableFromInline // FIXME(cocoa-index): Make inlinable
@_effects(readonly)
internal static func == (
- lhs: _CocoaDictionary.Index,
- rhs: _CocoaDictionary.Index
+ lhs: __CocoaDictionary.Index,
+ rhs: __CocoaDictionary.Index
) -> Bool {
_precondition(lhs.storage.base.object === rhs.storage.base.object,
"Comparing indexes from different dictionaries")
@@ -663,12 +667,12 @@
}
}
-extension _CocoaDictionary.Index: Comparable {
+extension __CocoaDictionary.Index: Comparable {
@usableFromInline // FIXME(cocoa-index): Make inlinable
@_effects(readonly)
internal static func < (
- lhs: _CocoaDictionary.Index,
- rhs: _CocoaDictionary.Index
+ lhs: __CocoaDictionary.Index,
+ rhs: __CocoaDictionary.Index
) -> Bool {
_precondition(lhs.storage.base.object === rhs.storage.base.object,
"Comparing indexes from different dictionaries")
@@ -676,7 +680,7 @@
}
}
-extension _CocoaDictionary: Sequence {
+extension __CocoaDictionary: Sequence {
@usableFromInline
final internal class Iterator {
// Cocoa Dictionary iterator has to be a class, otherwise we cannot
@@ -692,7 +696,7 @@
// `_fastEnumerationState`. There's code below relying on this.
internal var _fastEnumerationStackBuf = _CocoaFastEnumerationStackBuf()
- internal let base: _CocoaDictionary
+ internal let base: __CocoaDictionary
internal var _fastEnumerationStatePtr:
UnsafeMutablePointer<_SwiftNSFastEnumerationState> {
@@ -713,7 +717,7 @@
internal var itemIndex: Int = 0
internal var itemCount: Int = 0
- internal init(_ base: __owned _CocoaDictionary) {
+ internal init(_ base: __owned __CocoaDictionary) {
self.base = base
}
}
@@ -725,7 +729,7 @@
}
}
-extension _CocoaDictionary.Iterator: IteratorProtocol {
+extension __CocoaDictionary.Iterator: IteratorProtocol {
@usableFromInline
internal typealias Element = (key: AnyObject, value: AnyObject)
@@ -796,7 +800,7 @@
return Dictionary(_native: _NativeDictionary(nativeStorage))
}
- if s === _RawDictionaryStorage.empty {
+ if s === __RawDictionaryStorage.empty {
return Dictionary()
}
diff --git a/stdlib/public/core/DictionaryStorage.swift b/stdlib/public/core/DictionaryStorage.swift
index f3579af..39ac765 100644
--- a/stdlib/public/core/DictionaryStorage.swift
+++ b/stdlib/public/core/DictionaryStorage.swift
@@ -16,10 +16,13 @@
/// Enough bytes are allocated to hold the bitmap for marking valid entries,
/// keys, and values. The data layout starts with the bitmap, followed by the
/// keys, followed by the values.
+// NOTE: older runtimes called this class _RawDictionaryStorage. The two
+// must coexist without a conflicting ObjC class name, so it was
+// renamed. The old name must not be used in the new runtime.
@_fixed_layout
@usableFromInline
@_objc_non_lazy_realization
-internal class _RawDictionaryStorage: __SwiftNativeNSDictionary {
+internal class __RawDictionaryStorage: __SwiftNativeNSDictionary {
// NOTE: The precise layout of this type is relied on in the runtime to
// provide a statically allocated empty singleton. See
// stdlib/public/stubs/GlobalObjects.cpp for details.
@@ -109,9 +112,12 @@
/// The storage class for the singleton empty set.
/// The single instance of this class is created by the runtime.
+// NOTE: older runtimes called this class _EmptyDictionarySingleton.
+// The two must coexist without a conflicting ObjC class name, so it was
+// renamed. The old name must not be used in the new runtime.
@_fixed_layout
@usableFromInline
-internal class _EmptyDictionarySingleton: _RawDictionaryStorage {
+internal class __EmptyDictionarySingleton: __RawDictionaryStorage {
@nonobjc
internal override init(_doNotCallMe: ()) {
_internalInvariantFailure("This class cannot be directly initialized")
@@ -130,7 +136,7 @@
}
#if _runtime(_ObjC)
-extension _EmptyDictionarySingleton: _NSDictionaryCore {
+extension __EmptyDictionarySingleton: _NSDictionaryCore {
@objc(copyWithZone:)
internal func copy(with zone: _SwiftNSZone?) -> AnyObject {
return self
@@ -167,7 +173,7 @@
@objc(keyEnumerator)
internal func keyEnumerator() -> _NSEnumerator {
- return _SwiftEmptyNSEnumerator()
+ return __SwiftEmptyNSEnumerator()
}
@objc(getObjects:andKeys:count:)
@@ -180,13 +186,13 @@
}
#endif
-extension _RawDictionaryStorage {
+extension __RawDictionaryStorage {
/// The empty singleton that is used for every single Dictionary that is
/// created without any elements. The contents of the storage should never
/// be mutated.
@inlinable
@nonobjc
- internal static var empty: _EmptyDictionarySingleton {
+ internal static var empty: __EmptyDictionarySingleton {
return Builtin.bridgeFromRawPointer(
Builtin.addressof(&_swiftEmptyDictionarySingleton))
}
@@ -194,7 +200,7 @@
@usableFromInline
final internal class _DictionaryStorage<Key: Hashable, Value>
- : _RawDictionaryStorage, _NSDictionaryCore {
+ : __RawDictionaryStorage, _NSDictionaryCore {
// This type is made with allocWithTailElems, so no init is ever called.
// But we still need to have an init to satisfy the compiler.
@nonobjc
@@ -359,7 +365,7 @@
@usableFromInline
@_effects(releasenone)
internal static func copy(
- original: _RawDictionaryStorage
+ original: __RawDictionaryStorage
) -> _DictionaryStorage {
return allocate(
scale: original._scale,
@@ -370,7 +376,7 @@
@usableFromInline
@_effects(releasenone)
static internal func resize(
- original: _RawDictionaryStorage,
+ original: __RawDictionaryStorage,
capacity: Int,
move: Bool
) -> _DictionaryStorage {
@@ -389,7 +395,7 @@
@usableFromInline
@_effects(releasenone)
static internal func convert(
- _ cocoa: _CocoaDictionary,
+ _ cocoa: __CocoaDictionary,
capacity: Int
) -> _DictionaryStorage {
let scale = _HashTable.scale(forCapacity: capacity)
diff --git a/stdlib/public/core/DictionaryVariant.swift b/stdlib/public/core/DictionaryVariant.swift
index 3d9992d..c091de0 100644
--- a/stdlib/public/core/DictionaryVariant.swift
+++ b/stdlib/public/core/DictionaryVariant.swift
@@ -35,7 +35,7 @@
@_fixed_layout
internal struct _Variant {
@usableFromInline
- internal var object: _BridgeStorage<_RawDictionaryStorage>
+ internal var object: _BridgeStorage<__RawDictionaryStorage>
@inlinable
@inline(__always)
@@ -56,7 +56,7 @@
#if _runtime(_ObjC)
@inlinable
@inline(__always)
- init(cocoa: __owned _CocoaDictionary) {
+ init(cocoa: __owned __CocoaDictionary) {
self.object = _BridgeStorage(objC: cocoa.object)
}
#endif
@@ -102,8 +102,8 @@
#if _runtime(_ObjC)
@inlinable
- internal var asCocoa: _CocoaDictionary {
- return _CocoaDictionary(object.objCInstance)
+ internal var asCocoa: __CocoaDictionary {
+ return __CocoaDictionary(object.objCInstance)
}
#endif
diff --git a/stdlib/public/core/Hashing.swift b/stdlib/public/core/Hashing.swift
index 379e83b..1429f5c 100644
--- a/stdlib/public/core/Hashing.swift
+++ b/stdlib/public/core/Hashing.swift
@@ -71,7 +71,10 @@
#if _runtime(_ObjC)
/// An NSEnumerator implementation returning zero elements. This is useful when
/// a concrete element type is not recoverable from the empty singleton.
-final internal class _SwiftEmptyNSEnumerator
+// NOTE: older runtimes called this class _SwiftEmptyNSEnumerator. The two
+// must coexist without conflicting ObjC class names, so it was
+// renamed. The old name must not be used in the new runtime.
+final internal class __SwiftEmptyNSEnumerator
: __SwiftNativeNSEnumerator, _NSEnumerator {
internal override required init() {}
@@ -107,8 +110,11 @@
///
/// Using a dedicated class for this rather than a _BridgingBuffer makes it easy
/// to recognize these in heap dumps etc.
-internal final class _BridgingHashBuffer
- : ManagedBuffer<_BridgingHashBuffer.Header, AnyObject> {
+// NOTE: older runtimes called this class _BridgingHashBuffer.
+// The two must coexist without a conflicting ObjC class name, so it
+// was renamed. The old name must not be used in the new runtime.
+internal final class __BridgingHashBuffer
+ : ManagedBuffer<__BridgingHashBuffer.Header, AnyObject> {
struct Header {
internal var owner: AnyObject
internal var hashTable: _HashTable
@@ -122,11 +128,11 @@
internal static func allocate(
owner: AnyObject,
hashTable: _HashTable
- ) -> _BridgingHashBuffer {
+ ) -> __BridgingHashBuffer {
let buffer = self.create(minimumCapacity: hashTable.bucketCount) { _ in
Header(owner: owner, hashTable: hashTable)
}
- return unsafeDowncast(buffer, to: _BridgingHashBuffer.self)
+ return unsafeDowncast(buffer, to: __BridgingHashBuffer.self)
}
deinit {
diff --git a/stdlib/public/core/NativeDictionary.swift b/stdlib/public/core/NativeDictionary.swift
index f6abdaf..c475f33 100644
--- a/stdlib/public/core/NativeDictionary.swift
+++ b/stdlib/public/core/NativeDictionary.swift
@@ -10,7 +10,7 @@
//
//===----------------------------------------------------------------------===//
-/// A wrapper around _RawDictionaryStorage that provides most of the
+/// A wrapper around __RawDictionaryStorage that provides most of the
/// implementation of Dictionary.
@usableFromInline
@_fixed_layout
@@ -18,20 +18,20 @@
@usableFromInline
internal typealias Element = (key: Key, value: Value)
- /// See this comments on _RawDictionaryStorage and its subclasses to
+ /// See this comments on __RawDictionaryStorage and its subclasses to
/// understand why we store an untyped storage here.
@usableFromInline
- internal var _storage: _RawDictionaryStorage
+ internal var _storage: __RawDictionaryStorage
/// Constructs an instance from the empty singleton.
@inlinable
internal init() {
- self._storage = _RawDictionaryStorage.empty
+ self._storage = __RawDictionaryStorage.empty
}
/// Constructs a dictionary adopting the given storage.
@inlinable
- internal init(_ storage: __owned _RawDictionaryStorage) {
+ internal init(_ storage: __owned __RawDictionaryStorage) {
self._storage = storage
}
@@ -42,12 +42,12 @@
#if _runtime(_ObjC)
@inlinable
- internal init(_ cocoa: __owned _CocoaDictionary) {
+ internal init(_ cocoa: __owned __CocoaDictionary) {
self.init(cocoa, capacity: cocoa.count)
}
@inlinable
- internal init(_ cocoa: __owned _CocoaDictionary, capacity: Int) {
+ internal init(_ cocoa: __owned __CocoaDictionary, capacity: Int) {
_internalInvariant(cocoa.count <= capacity)
self._storage =
_DictionaryStorage<Key, Value>.convert(cocoa, capacity: capacity)
@@ -591,7 +591,7 @@
#if _runtime(_ObjC)
@inlinable
- func isEqual(to other: _CocoaDictionary) -> Bool {
+ func isEqual(to other: __CocoaDictionary) -> Bool {
if self.count != other.count { return false }
defer { _fixLifetime(self) }
diff --git a/stdlib/public/core/NativeSet.swift b/stdlib/public/core/NativeSet.swift
index fa7a89e..ec18aef 100644
--- a/stdlib/public/core/NativeSet.swift
+++ b/stdlib/public/core/NativeSet.swift
@@ -10,27 +10,27 @@
//
//===----------------------------------------------------------------------===//
-/// A wrapper around _RawSetStorage that provides most of the
+/// A wrapper around __RawSetStorage that provides most of the
/// implementation of Set.
@usableFromInline
@_fixed_layout
internal struct _NativeSet<Element: Hashable> {
- /// See the comments on _RawSetStorage and its subclasses to understand why we
+ /// See the comments on __RawSetStorage and its subclasses to understand why we
/// store an untyped storage here.
@usableFromInline
- internal var _storage: _RawSetStorage
+ internal var _storage: __RawSetStorage
/// Constructs an instance from the empty singleton.
@inlinable
@inline(__always)
internal init() {
- self._storage = _RawSetStorage.empty
+ self._storage = __RawSetStorage.empty
}
/// Constructs a native set adopting the given storage.
@inlinable
@inline(__always)
- internal init(_ storage: __owned _RawSetStorage) {
+ internal init(_ storage: __owned __RawSetStorage) {
self._storage = storage
}
@@ -41,12 +41,12 @@
#if _runtime(_ObjC)
@inlinable
- internal init(_ cocoa: __owned _CocoaSet) {
+ internal init(_ cocoa: __owned __CocoaSet) {
self.init(cocoa, capacity: cocoa.count)
}
@inlinable
- internal init(_ cocoa: __owned _CocoaSet, capacity: Int) {
+ internal init(_ cocoa: __owned __CocoaSet, capacity: Int) {
_internalInvariant(cocoa.count <= capacity)
self._storage = _SetStorage<Element>.convert(cocoa, capacity: capacity)
for element in cocoa {
@@ -439,7 +439,7 @@
#if _runtime(_ObjC)
@inlinable
- func isEqual(to other: _CocoaSet) -> Bool {
+ func isEqual(to other: __CocoaSet) -> Bool {
if self.count != other.count { return false }
defer { _fixLifetime(self) }
diff --git a/stdlib/public/core/Set.swift b/stdlib/public/core/Set.swift
index 4326bf8..33c3d0f 100644
--- a/stdlib/public/core/Set.swift
+++ b/stdlib/public/core/Set.swift
@@ -174,7 +174,7 @@
#if _runtime(_ObjC)
@inlinable
- internal init(_cocoa: __owned _CocoaSet) {
+ internal init(_cocoa: __owned __CocoaSet) {
_variant = _Variant(cocoa: _cocoa)
}
@@ -190,7 +190,7 @@
init(_immutableCocoaSet: __owned AnyObject) {
_internalInvariant(_isBridgedVerbatimToObjectiveC(Element.self),
"Set can be backed by NSSet _variant only when the member type can be bridged verbatim to Objective-C")
- self.init(_cocoa: _CocoaSet(_immutableCocoaSet))
+ self.init(_cocoa: __CocoaSet(_immutableCocoaSet))
}
#endif
}
@@ -1279,7 +1279,7 @@
internal enum _Variant {
case native(_HashTable.Index)
#if _runtime(_ObjC)
- case cocoa(_CocoaSet.Index)
+ case cocoa(__CocoaSet.Index)
#endif
}
@@ -1301,7 +1301,7 @@
#if _runtime(_ObjC)
@inlinable
@inline(__always)
- internal init(_cocoa index: __owned _CocoaSet.Index) {
+ internal init(_cocoa index: __owned __CocoaSet.Index) {
self.init(_variant: .cocoa(index))
}
#endif
@@ -1362,7 +1362,7 @@
#if _runtime(_ObjC)
@usableFromInline
- internal var _asCocoa: _CocoaSet.Index {
+ internal var _asCocoa: __CocoaSet.Index {
@_transparent
get {
switch _variant {
@@ -1467,7 +1467,7 @@
internal enum _Variant {
case native(_NativeSet<Element>.Iterator)
#if _runtime(_ObjC)
- case cocoa(_CocoaSet.Iterator)
+ case cocoa(__CocoaSet.Iterator)
#endif
}
@@ -1486,7 +1486,7 @@
#if _runtime(_ObjC)
@usableFromInline
- internal init(_cocoa: __owned _CocoaSet.Iterator) {
+ internal init(_cocoa: __owned __CocoaSet.Iterator) {
self.init(_variant: .cocoa(_cocoa))
}
#endif
@@ -1542,7 +1542,7 @@
#if _runtime(_ObjC)
@usableFromInline @_transparent
- internal var _asCocoa: _CocoaSet.Iterator {
+ internal var _asCocoa: __CocoaSet.Iterator {
get {
switch _variant {
case .native:
diff --git a/stdlib/public/core/SetBridging.swift b/stdlib/public/core/SetBridging.swift
index 9c9d208..bc84a59 100644
--- a/stdlib/public/core/SetBridging.swift
+++ b/stdlib/public/core/SetBridging.swift
@@ -38,8 +38,8 @@
// Temporary var for SOME type safety.
let nsSet: _NSSetCore
- if _storage === _RawSetStorage.empty || count == 0 {
- nsSet = _RawSetStorage.empty
+ if _storage === __RawSetStorage.empty || count == 0 {
+ nsSet = __RawSetStorage.empty
} else if _isBridgedVerbatimToObjectiveC(Element.self) {
nsSet = unsafeDowncast(_storage, to: _SetStorage<Element>.self)
} else {
@@ -59,7 +59,7 @@
: __SwiftNativeNSEnumerator, _NSEnumerator {
@nonobjc internal var base: _NativeSet<Element>
- @nonobjc internal var bridgedElements: _BridgingHashBuffer?
+ @nonobjc internal var bridgedElements: __BridgingHashBuffer?
@nonobjc internal var nextBucket: _NativeSet<Element>.Bucket
@nonobjc internal var endBucket: _NativeSet<Element>.Bucket
@@ -172,27 +172,27 @@
/// The buffer for bridged Set elements, if present.
@nonobjc
- private var _bridgedElements: _BridgingHashBuffer? {
+ private var _bridgedElements: __BridgingHashBuffer? {
guard let ref = _stdlib_atomicLoadARCRef(object: _bridgedElementsPtr) else {
return nil
}
- return unsafeDowncast(ref, to: _BridgingHashBuffer.self)
+ return unsafeDowncast(ref, to: __BridgingHashBuffer.self)
}
/// Attach a buffer for bridged Set elements.
@nonobjc
- private func _initializeBridgedElements(_ storage: _BridgingHashBuffer) {
+ private func _initializeBridgedElements(_ storage: __BridgingHashBuffer) {
_stdlib_atomicInitializeARCRef(
object: _bridgedElementsPtr,
desired: storage)
}
@nonobjc
- internal func bridgeElements() -> _BridgingHashBuffer {
+ internal func bridgeElements() -> __BridgingHashBuffer {
if let bridgedElements = _bridgedElements { return bridgedElements }
// Allocate and initialize heap storage for bridged objects.
- let bridged = _BridgingHashBuffer.allocate(
+ let bridged = __BridgingHashBuffer.allocate(
owner: native._storage,
hashTable: native.hashTable)
for bucket in native.hashTable {
@@ -285,9 +285,13 @@
}
}
+// NOTE: older overlays called this struct _CocoaSet. The two
+// must coexist without conflicting ObjC class names from the nested
+// classes, so it was renamed. The old names must not be used in the new
+// runtime.
@usableFromInline
@_fixed_layout
-internal struct _CocoaSet {
+internal struct __CocoaSet {
@usableFromInline
internal let object: AnyObject
@@ -297,7 +301,7 @@
}
}
-extension _CocoaSet {
+extension __CocoaSet {
@usableFromInline
@_effects(releasenone)
internal func member(for index: Index) -> AnyObject {
@@ -311,14 +315,14 @@
}
}
-extension _CocoaSet {
+extension __CocoaSet {
@usableFromInline
- internal func isEqual(to other: _CocoaSet) -> Bool {
+ internal func isEqual(to other: __CocoaSet) -> Bool {
return _stdlib_NSObject_isEqual(self.object, other.object)
}
}
-extension _CocoaSet: _SetBuffer {
+extension __CocoaSet: _SetBuffer {
@usableFromInline
internal typealias Element = AnyObject
@@ -404,7 +408,7 @@
}
}
-extension _CocoaSet {
+extension __CocoaSet {
@_fixed_layout
@usableFromInline
internal struct Index {
@@ -426,7 +430,7 @@
}
}
-extension _CocoaSet.Index {
+extension __CocoaSet.Index {
// FIXME(cocoa-index): Try using an NSEnumerator to speed this up.
internal class Storage {
// Assumption: we rely on NSDictionary.getObjects when being
@@ -436,7 +440,7 @@
/// A reference to the NSSet, which owns members in `allObjects`,
/// or `allKeys`, for NSSet and NSDictionary respectively.
- internal let base: _CocoaSet
+ internal let base: __CocoaSet
// FIXME: swift-3-indexing-model: try to remove the cocoa reference, but
// make sure that we have a safety check for accessing `allKeys`. Maybe
// move both into the dictionary/set itself.
@@ -445,7 +449,7 @@
internal var allKeys: _BridgingBuffer
internal init(
- _ base: __owned _CocoaSet,
+ _ base: __owned __CocoaSet,
_ allKeys: __owned _BridgingBuffer
) {
self.base = base
@@ -454,7 +458,7 @@
}
}
-extension _CocoaSet.Index {
+extension __CocoaSet.Index {
@usableFromInline
internal var handleBitPattern: UInt {
@_effects(readonly)
@@ -464,7 +468,7 @@
}
}
-extension _CocoaSet.Index {
+extension __CocoaSet.Index {
@usableFromInline // FIXME(cocoa-index): Make inlinable
@nonobjc
internal var element: AnyObject {
@@ -486,27 +490,27 @@
}
}
-extension _CocoaSet.Index: Equatable {
+extension __CocoaSet.Index: Equatable {
@usableFromInline // FIXME(cocoa-index): Make inlinable
@_effects(readonly)
- internal static func == (lhs: _CocoaSet.Index, rhs: _CocoaSet.Index) -> Bool {
+ internal static func == (lhs: __CocoaSet.Index, rhs: __CocoaSet.Index) -> Bool {
_precondition(lhs.storage.base.object === rhs.storage.base.object,
"Comparing indexes from different sets")
return lhs._offset == rhs._offset
}
}
-extension _CocoaSet.Index: Comparable {
+extension __CocoaSet.Index: Comparable {
@usableFromInline // FIXME(cocoa-index): Make inlinable
@_effects(readonly)
- internal static func < (lhs: _CocoaSet.Index, rhs: _CocoaSet.Index) -> Bool {
+ internal static func < (lhs: __CocoaSet.Index, rhs: __CocoaSet.Index) -> Bool {
_precondition(lhs.storage.base.object === rhs.storage.base.object,
"Comparing indexes from different sets")
return lhs._offset < rhs._offset
}
}
-extension _CocoaSet: Sequence {
+extension __CocoaSet: Sequence {
@usableFromInline
final internal class Iterator {
// Cocoa Set iterator has to be a class, otherwise we cannot
@@ -522,7 +526,7 @@
// `_fastEnumerationState`. There's code below relying on this.
internal var _fastEnumerationStackBuf = _CocoaFastEnumerationStackBuf()
- internal let base: _CocoaSet
+ internal let base: __CocoaSet
internal var _fastEnumerationStatePtr:
UnsafeMutablePointer<_SwiftNSFastEnumerationState> {
@@ -543,7 +547,7 @@
internal var itemIndex: Int = 0
internal var itemCount: Int = 0
- internal init(_ base: __owned _CocoaSet) {
+ internal init(_ base: __owned __CocoaSet) {
self.base = base
}
}
@@ -554,7 +558,7 @@
}
}
-extension _CocoaSet.Iterator: IteratorProtocol {
+extension __CocoaSet.Iterator: IteratorProtocol {
@usableFromInline
internal typealias Element = AnyObject
@@ -618,7 +622,7 @@
return Set(_native: _NativeSet(nativeStorage))
}
- if s === _RawSetStorage.empty {
+ if s === __RawSetStorage.empty {
return Set()
}
diff --git a/stdlib/public/core/SetStorage.swift b/stdlib/public/core/SetStorage.swift
index f4a5086..44936c8 100644
--- a/stdlib/public/core/SetStorage.swift
+++ b/stdlib/public/core/SetStorage.swift
@@ -16,10 +16,13 @@
/// Enough bytes are allocated to hold the bitmap for marking valid entries,
/// keys, and values. The data layout starts with the bitmap, followed by the
/// keys, followed by the values.
+// NOTE: older runtimes called this class _RawSetStorage. The two
+// must coexist without a conflicting ObjC class name, so it was
+// renamed. The old name must not be used in the new runtime.
@_fixed_layout
@usableFromInline
@_objc_non_lazy_realization
-internal class _RawSetStorage: __SwiftNativeNSSet {
+internal class __RawSetStorage: __SwiftNativeNSSet {
// NOTE: The precise layout of this type is relied on in the runtime to
// provide a statically allocated empty singleton. See
// stdlib/public/stubs/GlobalObjects.cpp for details.
@@ -104,9 +107,12 @@
/// The storage class for the singleton empty set.
/// The single instance of this class is created by the runtime.
+// NOTE: older runtimes called this class _EmptySetSingleton. The two
+// must coexist without conflicting ObjC class names, so it was renamed.
+// The old names must not be used in the new runtime.
@_fixed_layout
@usableFromInline
-internal class _EmptySetSingleton: _RawSetStorage {
+internal class __EmptySetSingleton: __RawSetStorage {
@nonobjc
override internal init(_doNotCallMe: ()) {
_internalInvariantFailure("This class cannot be directly initialized")
@@ -120,18 +126,18 @@
#endif
}
-extension _RawSetStorage {
+extension __RawSetStorage {
/// The empty singleton that is used for every single Set that is created
/// without any elements. The contents of the storage must never be mutated.
@inlinable
@nonobjc
- internal static var empty: _EmptySetSingleton {
+ internal static var empty: __EmptySetSingleton {
return Builtin.bridgeFromRawPointer(
Builtin.addressof(&_swiftEmptySetSingleton))
}
}
-extension _EmptySetSingleton: _NSSetCore {
+extension __EmptySetSingleton: _NSSetCore {
#if _runtime(_ObjC)
//
// NSSet implementation, assuming Self is the empty singleton
@@ -153,7 +159,7 @@
@objc
internal func objectEnumerator() -> _NSEnumerator {
- return _SwiftEmptyNSEnumerator()
+ return __SwiftEmptyNSEnumerator()
}
@objc(countByEnumeratingWithState:objects:count:)
@@ -177,7 +183,7 @@
@usableFromInline
final internal class _SetStorage<Element: Hashable>
- : _RawSetStorage, _NSSetCore {
+ : __RawSetStorage, _NSSetCore {
// This type is made with allocWithTailElems, so no init is ever called.
// But we still need to have an init to satisfy the compiler.
@nonobjc
@@ -284,7 +290,7 @@
extension _SetStorage {
@usableFromInline
@_effects(releasenone)
- internal static func copy(original: _RawSetStorage) -> _SetStorage {
+ internal static func copy(original: __RawSetStorage) -> _SetStorage {
return .allocate(
scale: original._scale,
age: original._age,
@@ -294,7 +300,7 @@
@usableFromInline
@_effects(releasenone)
static internal func resize(
- original: _RawSetStorage,
+ original: __RawSetStorage,
capacity: Int,
move: Bool
) -> _SetStorage {
@@ -313,7 +319,7 @@
@usableFromInline
@_effects(releasenone)
static internal func convert(
- _ cocoa: _CocoaSet,
+ _ cocoa: __CocoaSet,
capacity: Int
) -> _SetStorage {
let scale = _HashTable.scale(forCapacity: capacity)
diff --git a/stdlib/public/core/SetVariant.swift b/stdlib/public/core/SetVariant.swift
index 24e4e50..355b5188 100644
--- a/stdlib/public/core/SetVariant.swift
+++ b/stdlib/public/core/SetVariant.swift
@@ -31,7 +31,7 @@
@_fixed_layout
internal struct _Variant {
@usableFromInline
- internal var object: _BridgeStorage<_RawSetStorage>
+ internal var object: _BridgeStorage<__RawSetStorage>
@inlinable
@inline(__always)
@@ -52,7 +52,7 @@
#if _runtime(_ObjC)
@inlinable
@inline(__always)
- init(cocoa: __owned _CocoaSet) {
+ init(cocoa: __owned __CocoaSet) {
self.object = _BridgeStorage(objC: cocoa.object)
}
#endif
@@ -103,8 +103,8 @@
#if _runtime(_ObjC)
@inlinable
- internal var asCocoa: _CocoaSet {
- return _CocoaSet(object.objCInstance)
+ internal var asCocoa: __CocoaSet {
+ return __CocoaSet(object.objCInstance)
}
#endif
@@ -318,7 +318,7 @@
#if _runtime(_ObjC)
@inlinable
internal mutating func _migrateToNative(
- _ cocoa: _CocoaSet,
+ _ cocoa: __CocoaSet,
removing member: Element
) -> Element {
// FIXME(performance): fuse data migration and element deletion into one
diff --git a/stdlib/public/core/StringBridge.swift b/stdlib/public/core/StringBridge.swift
index 1fc25c2..21b7cb9 100644
--- a/stdlib/public/core/StringBridge.swift
+++ b/stdlib/public/core/StringBridge.swift
@@ -149,9 +149,9 @@
#endif
switch _unsafeAddressOfCocoaStringClass(str) {
- case unsafeBitCast(_StringStorage.self, to: UInt.self):
+ case unsafeBitCast(__StringStorage.self, to: UInt.self):
self = .storage
- case unsafeBitCast(_SharedStringStorage.self, to: UInt.self):
+ case unsafeBitCast(__SharedStringStorage.self, to: UInt.self):
self = .shared
default:
self = .cocoa
@@ -216,10 +216,10 @@
switch _KnownCocoaString(cocoaString) {
case .storage:
return _unsafeUncheckedDowncast(
- cocoaString, to: _StringStorage.self).asString._guts
+ cocoaString, to: __StringStorage.self).asString._guts
case .shared:
return _unsafeUncheckedDowncast(
- cocoaString, to: _SharedStringStorage.self).asString._guts
+ cocoaString, to: __SharedStringStorage.self).asString._guts
#if !(arch(i386) || arch(arm))
case .tagged:
return _StringGuts(_SmallString(taggedCocoa: cocoaString))
@@ -284,7 +284,7 @@
// TODO: We'd rather emit a valid ObjC object statically than create a
// shared string class instance.
let gutsCountAndFlags = _guts._object._countAndFlags
- return _SharedStringStorage(
+ return __SharedStringStorage(
immortal: _guts._object.fastUTF8.baseAddress!,
countAndFlags: _StringObject.CountAndFlags(
sharedCount: _guts.count, isASCII: gutsCountAndFlags.isASCII))
diff --git a/stdlib/public/core/StringCreate.swift b/stdlib/public/core/StringCreate.swift
index ec032c1..262f0ee 100644
--- a/stdlib/public/core/StringCreate.swift
+++ b/stdlib/public/core/StringCreate.swift
@@ -38,7 +38,7 @@
return String(_StringGuts(smol))
}
- let storage = _StringStorage.create(initializingFrom: input, isASCII: true)
+ let storage = __StringStorage.create(initializingFrom: input, isASCII: true)
return storage.asString
}
@@ -83,7 +83,7 @@
return String(_StringGuts(smol))
}
- let storage = _StringStorage.create(
+ let storage = __StringStorage.create(
initializingFrom: input, isASCII: isASCII)
return storage.asString
}
@@ -98,7 +98,7 @@
}
let isASCII = asciiPreScanResult
- let storage = _StringStorage.create(
+ let storage = __StringStorage.create(
initializingFrom: input, isASCII: isASCII)
return storage.asString
}
diff --git a/stdlib/public/core/StringGuts.swift b/stdlib/public/core/StringGuts.swift
index 03aeb06..f90a886 100644
--- a/stdlib/public/core/StringGuts.swift
+++ b/stdlib/public/core/StringGuts.swift
@@ -56,11 +56,11 @@
}
@inline(__always)
- internal init(_ storage: _StringStorage) {
+ internal init(_ storage: __StringStorage) {
self.init(_StringObject(storage))
}
- internal init(_ storage: _SharedStringStorage) {
+ internal init(_ storage: __SharedStringStorage) {
self.init(_StringObject(storage))
}
diff --git a/stdlib/public/core/StringGutsRangeReplaceable.swift b/stdlib/public/core/StringGutsRangeReplaceable.swift
index f1c918d..fc27b12 100644
--- a/stdlib/public/core/StringGutsRangeReplaceable.swift
+++ b/stdlib/public/core/StringGutsRangeReplaceable.swift
@@ -84,7 +84,7 @@
if _fastPath(isFastUTF8) {
let isASCII = self.isASCII
let storage = self.withFastUTF8 {
- _StringStorage.create(
+ __StringStorage.create(
initializingFrom: $0, capacity: growthTarget, isASCII: isASCII)
}
@@ -101,7 +101,7 @@
// into a StringStorage space.
let selfUTF8 = Array(String(self).utf8)
selfUTF8.withUnsafeBufferPointer {
- self = _StringGuts(_StringStorage.create(
+ self = _StringGuts(__StringStorage.create(
initializingFrom: $0, capacity: n, isASCII: self.isASCII))
}
}
diff --git a/stdlib/public/core/StringObject.swift b/stdlib/public/core/StringObject.swift
index 49b94f3..5bc877f 100644
--- a/stdlib/public/core/StringObject.swift
+++ b/stdlib/public/core/StringObject.swift
@@ -838,13 +838,13 @@
}
}
- internal var nativeStorage: _StringStorage {
+ internal var nativeStorage: __StringStorage {
@inline(__always) get {
#if arch(i386) || arch(arm)
guard case .native(let storage) = _variant else {
_internalInvariantFailure()
}
- return _unsafeUncheckedDowncast(storage, to: _StringStorage.self)
+ return _unsafeUncheckedDowncast(storage, to: __StringStorage.self)
#else
_internalInvariant(hasNativeStorage)
return Builtin.reinterpretCast(largeAddressBits)
@@ -852,13 +852,13 @@
}
}
- internal var sharedStorage: _SharedStringStorage {
+ internal var sharedStorage: __SharedStringStorage {
@inline(__always) get {
#if arch(i386) || arch(arm)
guard case .native(let storage) = _variant else {
_internalInvariantFailure()
}
- return _unsafeUncheckedDowncast(storage, to: _SharedStringStorage.self)
+ return _unsafeUncheckedDowncast(storage, to: __SharedStringStorage.self)
#else
_internalInvariant(largeFastIsShared && !largeIsCocoa)
_internalInvariant(hasSharedStorage)
@@ -982,7 +982,7 @@
}
@inline(__always)
- internal init(_ storage: _StringStorage) {
+ internal init(_ storage: __StringStorage) {
#if arch(i386) || arch(arm)
self.init(
variant: .native(storage),
@@ -996,7 +996,7 @@
#endif
}
- internal init(_ storage: _SharedStringStorage) {
+ internal init(_ storage: __SharedStringStorage) {
#if arch(i386) || arch(arm)
self.init(
variant: .native(storage),
@@ -1100,7 +1100,7 @@
}
if _countAndFlags.isNativelyStored {
let anyObj = Builtin.reinterpretCast(largeAddressBits) as AnyObject
- _internalInvariant(anyObj is _StringStorage)
+ _internalInvariant(anyObj is __StringStorage)
}
}
diff --git a/stdlib/public/core/StringStorage.swift b/stdlib/public/core/StringStorage.swift
index 260d958..d6f2694 100644
--- a/stdlib/public/core/StringStorage.swift
+++ b/stdlib/public/core/StringStorage.swift
@@ -126,10 +126,10 @@
switch knownOther {
case .storage:
return _nativeIsEqual(
- _unsafeUncheckedDowncast(other, to: _StringStorage.self))
+ _unsafeUncheckedDowncast(other, to: __StringStorage.self))
case .shared:
return _nativeIsEqual(
- _unsafeUncheckedDowncast(other, to: _SharedStringStorage.self))
+ _unsafeUncheckedDowncast(other, to: __SharedStringStorage.self))
#if !(arch(i386) || arch(arm))
case .tagged:
fallthrough
@@ -172,7 +172,10 @@
// Optional<_StringBreadcrumbs>.
//
-final internal class _StringStorage
+// NOTE: older runtimes called this class _StringStorage. The two
+// must coexist without conflicting ObjC class names, so it was
+// renamed. The old name must not be used in the new runtime.
+final internal class __StringStorage
: __SwiftNativeNSString, _AbstractStringStorage {
#if arch(i386) || arch(arm)
// The total allocated storage capacity. Note that this includes the required
@@ -299,7 +302,7 @@
@objc(copyWithZone:)
final internal func copy(with zone: _SwiftNSZone?) -> AnyObject {
- // While _StringStorage instances aren't immutable in general,
+ // While __StringStorage instances aren't immutable in general,
// mutations may only occur when instances are uniquely referenced.
// Therefore, it is safe to return self here; any outstanding Objective-C
// reference will make the instance non-unique.
@@ -350,13 +353,13 @@
}
// Creation
-extension _StringStorage {
+extension __StringStorage {
@_effects(releasenone)
private static func create(
realCodeUnitCapacity: Int, countAndFlags: CountAndFlags
- ) -> _StringStorage {
+ ) -> __StringStorage {
let storage = Builtin.allocWithTailElems_2(
- _StringStorage.self,
+ __StringStorage.self,
realCodeUnitCapacity._builtinWordValue, UInt8.self,
1._builtinWordValue, Optional<_StringBreadcrumbs>.self)
#if arch(i386) || arch(arm)
@@ -380,12 +383,12 @@
@_effects(releasenone)
private static func create(
capacity: Int, countAndFlags: CountAndFlags
- ) -> _StringStorage {
+ ) -> __StringStorage {
_internalInvariant(capacity >= countAndFlags.count)
let realCapacity = determineCodeUnitCapacity(capacity)
_internalInvariant(realCapacity > capacity)
- return _StringStorage.create(
+ return __StringStorage.create(
realCodeUnitCapacity: realCapacity, countAndFlags: countAndFlags)
}
@@ -394,11 +397,11 @@
initializingFrom bufPtr: UnsafeBufferPointer<UInt8>,
capacity: Int,
isASCII: Bool
- ) -> _StringStorage {
+ ) -> __StringStorage {
let countAndFlags = CountAndFlags(
mortalCount: bufPtr.count, isASCII: isASCII)
_internalInvariant(capacity >= bufPtr.count)
- let storage = _StringStorage.create(
+ let storage = __StringStorage.create(
capacity: capacity, countAndFlags: countAndFlags)
let addr = bufPtr.baseAddress._unsafelyUnwrappedUnchecked
storage.mutableStart.initialize(from: addr, count: bufPtr.count)
@@ -409,14 +412,14 @@
@_effects(releasenone)
internal static func create(
initializingFrom bufPtr: UnsafeBufferPointer<UInt8>, isASCII: Bool
- ) -> _StringStorage {
- return _StringStorage.create(
+ ) -> __StringStorage {
+ return __StringStorage.create(
initializingFrom: bufPtr, capacity: bufPtr.count, isASCII: isASCII)
}
}
// Usage
-extension _StringStorage {
+extension __StringStorage {
@inline(__always)
private var mutableStart: UnsafeMutablePointer<UInt8> {
return UnsafeMutablePointer(Builtin.projectTailElems(self, UInt8.self))
@@ -504,7 +507,7 @@
}
// Appending
-extension _StringStorage {
+extension __StringStorage {
// Perform common post-RRC adjustments and invariant enforcement.
@_effects(releasenone)
private func _postRRCAdjust(newCount: Int, newIsASCII: Bool) {
@@ -564,7 +567,7 @@
}
// Removing
-extension _StringStorage {
+extension __StringStorage {
@_effects(releasenone)
internal func remove(from lower: Int, to upper: Int) {
_internalInvariant(lower <= upper)
@@ -646,7 +649,10 @@
}
// For shared storage and bridging literals
-final internal class _SharedStringStorage
+// NOTE: older runtimes called this class _SharedStringStorage. The two
+// must coexist without conflicting ObjC class names, so it was
+// renamed. The old name must not be used in the new runtime.
+final internal class __SharedStringStorage
: __SwiftNativeNSString, _AbstractStringStorage {
internal var _owner: AnyObject?
internal var start: UnsafePointer<UInt8>
@@ -775,7 +781,7 @@
@objc(copyWithZone:)
final internal func copy(with zone: _SwiftNSZone?) -> AnyObject {
- // While _StringStorage instances aren't immutable in general,
+ // While __StringStorage instances aren't immutable in general,
// mutations may only occur when instances are uniquely referenced.
// Therefore, it is safe to return self here; any outstanding Objective-C
// reference will make the instance non-unique.
@@ -786,7 +792,7 @@
}
-extension _SharedStringStorage {
+extension __SharedStringStorage {
#if !INTERNAL_CHECKS_ENABLED
@inline(__always)
internal func _invariantCheck() {}
diff --git a/stdlib/public/core/SwiftNativeNSArray.swift b/stdlib/public/core/SwiftNativeNSArray.swift
index f6a6d1e..1c18175 100644
--- a/stdlib/public/core/SwiftNativeNSArray.swift
+++ b/stdlib/public/core/SwiftNativeNSArray.swift
@@ -160,10 +160,10 @@
to: Optional<AnyObject>.self)
}
- internal var _heapBufferBridged: _BridgingBufferStorage? {
+ internal var _heapBufferBridged: __BridgingBufferStorage? {
if let ref =
_stdlib_atomicLoadARCRef(object: _heapBufferBridgedPtr) {
- return unsafeBitCast(ref, to: _BridgingBufferStorage.self)
+ return unsafeBitCast(ref, to: __BridgingBufferStorage.self)
}
return nil
}
@@ -174,7 +174,7 @@
self._nativeStorage = _nativeStorage
}
- internal func _destroyBridgedStorage(_ hb: _BridgingBufferStorage?) {
+ internal func _destroyBridgedStorage(_ hb: __BridgingBufferStorage?) {
if let bridgedStorage = hb {
let buffer = _BridgingBuffer(bridgedStorage)
let count = buffer.count
@@ -216,7 +216,7 @@
// Another thread won the race. Throw out our buffer.
_destroyBridgedStorage(
- unsafeDowncast(objects.storage!, to: _BridgingBufferStorage.self))
+ unsafeDowncast(objects.storage!, to: __BridgingBufferStorage.self))
}
continue // Try again
}
diff --git a/stdlib/public/runtime/Metadata.cpp b/stdlib/public/runtime/Metadata.cpp
index 8e7287e..6e3f00a 100644
--- a/stdlib/public/runtime/Metadata.cpp
+++ b/stdlib/public/runtime/Metadata.cpp
@@ -2204,9 +2204,24 @@
auto string = Demangle::mangleNodeOld(globalNode);
- auto fullNameBuf = (char*)swift_slowAlloc(string.size() + 1, 0);
+ // If the class is in the Swift module, add a $ to the end of the ObjC
+ // name. The old and new Swift libraries must be able to coexist in
+ // the same process, and this avoids warnings due to the ObjC names
+ // colliding.
+ bool addSuffix = strncmp(string.c_str(), "_TtGCs", 6) == 0;
+
+ size_t allocationSize = string.size() + 1;
+ if (addSuffix)
+ allocationSize += 1;
+
+ auto fullNameBuf = (char*)swift_slowAlloc(allocationSize, 0);
memcpy(fullNameBuf, string.c_str(), string.size() + 1);
+ if (addSuffix) {
+ fullNameBuf[string.size()] = '$';
+ fullNameBuf[string.size() + 1] = '\0';
+ }
+
auto theMetaclass = (ClassMetadata *)object_getClass((id)theClass);
getROData(theClass)->Name = fullNameBuf;
diff --git a/stdlib/public/stubs/GlobalObjects.cpp b/stdlib/public/stubs/GlobalObjects.cpp
index aeed5ae..a59c3c1 100644
--- a/stdlib/public/stubs/GlobalObjects.cpp
+++ b/stdlib/public/stubs/GlobalObjects.cpp
@@ -28,13 +28,13 @@
SWIFT_RUNTIME_STDLIB_API
ClassMetadata CLASS_METADATA_SYM(s19__EmptyArrayStorage);
-// _direct type metadata for Swift._EmptyDictionarySingleton
+// _direct type metadata for Swift.__EmptyDictionarySingleton
SWIFT_RUNTIME_STDLIB_API
-ClassMetadata CLASS_METADATA_SYM(s25_EmptyDictionarySingleton);
+ClassMetadata CLASS_METADATA_SYM(s26__EmptyDictionarySingleton);
-// _direct type metadata for Swift._EmptySetSingleton
+// _direct type metadata for Swift.__EmptySetSingleton
SWIFT_RUNTIME_STDLIB_API
-ClassMetadata CLASS_METADATA_SYM(s18_EmptySetSingleton);
+ClassMetadata CLASS_METADATA_SYM(s19__EmptySetSingleton);
} // namespace swift
SWIFT_RUNTIME_STDLIB_API
@@ -55,7 +55,7 @@
swift::_SwiftEmptyDictionarySingleton swift::_swiftEmptyDictionarySingleton = {
// HeapObject header;
{
- &swift::CLASS_METADATA_SYM(s25_EmptyDictionarySingleton), // isa pointer
+ &swift::CLASS_METADATA_SYM(s26__EmptyDictionarySingleton), // isa pointer
},
// _SwiftDictionaryBodyStorage body;
@@ -82,7 +82,7 @@
swift::_SwiftEmptySetSingleton swift::_swiftEmptySetSingleton = {
// HeapObject header;
{
- &swift::CLASS_METADATA_SYM(s18_EmptySetSingleton), // isa pointer
+ &swift::CLASS_METADATA_SYM(s19__EmptySetSingleton), // isa pointer
},
// _SwiftSetBodyStorage body;
diff --git a/test/ClangImporter/private_frameworks.swift b/test/ClangImporter/private_frameworks.swift
index fe36da2..733ec81 100644
--- a/test/ClangImporter/private_frameworks.swift
+++ b/test/ClangImporter/private_frameworks.swift
@@ -12,7 +12,7 @@
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t) -emit-sil -o /dev/null -F %S/Inputs/privateframeworks/withprivate -swift-version 4 %s -import-objc-header %S/Inputs/privateframeworks/bridging-somekitcore.h -verify
// Use the overlay without private frameworks.
-// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t) -emit-sil -o /dev/null -F %S/Inputs/privateframeworks/withoutprivate -I %t -swift-version 4 -import-objc-header %S/Inputs/privateframeworks/bridging-somekit.h %s
+// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t) -emit-sil -o /dev/null -F %S/Inputs/privateframeworks/withoutprivate -swift-version 4 -import-objc-header %S/Inputs/privateframeworks/bridging-somekit.h %s
// Build the overlay with public frameworks.
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t) -emit-module -F %S/Inputs/privateframeworks/withoutprivate -o %t %S/Inputs/privateframeworks/overlay/SomeKit.swift
@@ -21,7 +21,18 @@
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t) -emit-sil -o /dev/null -F %S/Inputs/privateframeworks/withprivate -swift-version 4 %s -import-objc-header %S/Inputs/privateframeworks/bridging-somekitcore.h -verify
// Use the overlay without private frameworks.
-// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t) -emit-sil -o /dev/null -F %S/Inputs/privateframeworks/withoutprivate -I %t -swift-version 4 %s -import-objc-header %S/Inputs/privateframeworks/bridging-somekit.h
+// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t) -emit-sil -o /dev/null -F %S/Inputs/privateframeworks/withoutprivate -swift-version 4 %s -import-objc-header %S/Inputs/privateframeworks/bridging-somekit.h
+
+// Use something that uses the overlay.
+// RUN: echo 'import private_frameworks; testErrorConformance()' > %t/main.swift
+
+// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t) -emit-module -o %t -F %S/Inputs/privateframeworks/withprivate -swift-version 4 %s -import-objc-header %S/Inputs/privateframeworks/bridging-somekitcore.h
+// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t) -emit-sil -o /dev/null -F %S/Inputs/privateframeworks/withprivate %t/main.swift -verify
+// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t) -emit-sil -o /dev/null -F %S/Inputs/privateframeworks/withoutprivate %t/main.swift -verify
+
+// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t) -emit-module -o %t -F %S/Inputs/privateframeworks/withoutprivate -swift-version 4 %s -import-objc-header %S/Inputs/privateframeworks/bridging-somekit.h
+// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t) -emit-sil -o /dev/null -F %S/Inputs/privateframeworks/withprivate %t/main.swift -verify
+// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t) -emit-sil -o /dev/null -F %S/Inputs/privateframeworks/withoutprivate %t/main.swift -verify
// REQUIRES: objc_interop
@@ -50,3 +61,6 @@
SomeKit.someKitOtherGlobalFunc()
someKitOtherGlobalFunc()
}
+
+public struct ErrorsOnly<T: Error> {}
+public func testErrorConformance(_ code: ErrorsOnly<SKWidget.Error>? = nil) {}
diff --git a/test/IRGen/autolink-coff-force-link.swift b/test/IRGen/autolink-coff-force-link.swift
index 71422e1..e6a8fce 100644
--- a/test/IRGen/autolink-coff-force-link.swift
+++ b/test/IRGen/autolink-coff-force-link.swift
@@ -14,7 +14,7 @@
import swiftMSVCRT
-// CHECK: @"_swift_FORCE_LOAD_$_swiftMSVCRT_$_autolink" = weak hidden constant void ()* @"_swift_FORCE_LOAD_$_swiftMSVCRT"
+// CHECK: @"_swift_FORCE_LOAD_$_swiftMSVCRT_$_autolink" = weak_odr hidden constant void ()* @"_swift_FORCE_LOAD_$_swiftMSVCRT"
// CHECK: define dllexport void @"_swift_FORCE_LOAD_$_autolink"()
// CHECK-ASM-GNU: .ascii " -export:__swift_FORCE_LOAD_$_autolink"
diff --git a/test/IRGen/c_functions.swift b/test/IRGen/c_functions.swift
index f6fc966..20e4123 100644
--- a/test/IRGen/c_functions.swift
+++ b/test/IRGen/c_functions.swift
@@ -1,13 +1,13 @@
// RUN: %empty-directory(%t)
-// RUN: %target-swift-frontend -import-objc-header %S/Inputs/c_functions.h -primary-file %s -emit-ir | %FileCheck %s -check-prefix CHECK -check-prefix %target-cpu
+// RUN: %target-swift-frontend -enable-objc-interop -disable-objc-attr-requires-foundation-module -import-objc-header %S/Inputs/c_functions.h -primary-file %s -emit-ir | %FileCheck %s -check-prefix CHECK -check-prefix %target-cpu
// This is deliberately not a SIL test so that we can test SILGen too.
// CHECK-LABEL: define hidden swiftcc void @"$s11c_functions14testOverloadedyyF"
func testOverloaded() {
- // CHECK: call void @{{_Z10overloadedv|"\\01\?overloaded@@\$\$J0YAXXZ"}}()
+ // CHECK: call void @{{_Z10overloadedv|"\?overloaded@@\$\$J0YAXXZ"}}()
overloaded()
- // CHECK: call void @{{_Z10overloadedi|"\\01\?overloaded@@\$\$J0YAXH@Z"}}(i32{{( signext)?}} 42)
+ // CHECK: call void @{{_Z10overloadedi|"\?overloaded@@\$\$J0YAXH@Z"}}(i32{{( signext)?}} 42)
overloaded(42)
// CHECK: call void @{{.*}}test_my_log
test_my_log()
diff --git a/test/IRGen/class.sil b/test/IRGen/class.sil
index b161747..0fe2463 100644
--- a/test/IRGen/class.sil
+++ b/test/IRGen/class.sil
@@ -34,7 +34,7 @@
// CHECK: @"$s5class1CCMf" = internal global <{ {{.*}} }> <{
// \ CHECK: void ([[C_CLASS]]*)* @"$s5class1CCfD",
-// \ CHECK: i8** @"$sBoWV",
+// \ CHECK: i8** {{@"\$sBoWV"|null}},
// \ CHECK: i64 ptrtoint ([[OBJCCLASS]]* @"$s5class1CCMm" to i64),
// \ CHECK: [[OBJCCLASS]]* @"OBJC_CLASS_$_{{(_TtCs12_)?}}SwiftObject",
// \ CHECK: [[OPAQUE]]* @_objc_empty_cache,
diff --git a/test/IRGen/class_resilience.swift b/test/IRGen/class_resilience.swift
index c7285aa..831a86d 100644
--- a/test/IRGen/class_resilience.swift
+++ b/test/IRGen/class_resilience.swift
@@ -30,7 +30,7 @@
// CHECK: @"$s16class_resilience14ResilientChildCMo" = {{(protected )?}}{{(dllexport )?}}global [[BOUNDS]] zeroinitializer
-// CHECK: @"$s15resilient_class22ResilientOutsideParentC8getValueSiyFTq" = external global %swift.method_descriptor
+// CHECK: @"$s15resilient_class22ResilientOutsideParentC8getValueSiyFTq" = external{{( dllimport)?}} global %swift.method_descriptor
// CHECK: @"$s16class_resilience14ResilientChildCMn" = {{(protected )?}}{{(dllexport )?}}constant <{{.*}}> <{
// -- flags: class, unique, has vtable, has override table, in-place initialization, has resilient superclass
@@ -54,7 +54,7 @@
// -- field offset vector offset:
// CHECK-SAME: i32 0,
// -- superclass:
-// CHECK-SAME: @"got.$s15resilient_class22ResilientOutsideParentCMn"
+// CHECK-SAME: @"{{got.|__imp_}}$s15resilient_class22ResilientOutsideParentCMn"
// -- singleton metadata initialization cache:
// CHECK-SAME: @"$s16class_resilience14ResilientChildCMl"
// -- resilient pattern:
@@ -65,17 +65,17 @@
// CHECK-SAME: i32 2,
// CHECK-SAME: %swift.method_override_descriptor {
// -- base class:
-// CHECK-SAME: @"got.$s15resilient_class22ResilientOutsideParentCMn"
+// CHECK-SAME: @"{{got.|__imp_}}$s15resilient_class22ResilientOutsideParentCMn"
// -- base method:
-// CHECK-SAME: @"got.$s15resilient_class22ResilientOutsideParentC8getValueSiyFTq"
+// CHECK-SAME: @"{{got.|__imp_}}$s15resilient_class22ResilientOutsideParentC8getValueSiyFTq"
// -- implementation:
// CHECK-SAME: @"$s16class_resilience14ResilientChildC8getValueSiyF"
// CHECK-SAME: }
// CHECK-SAME: %swift.method_override_descriptor {
// -- base class:
-// CHECK-SAME: @"got.$s15resilient_class22ResilientOutsideParentCMn"
+// CHECK-SAME: @"{{got.|__imp_}}$s15resilient_class22ResilientOutsideParentCMn"
// -- base method:
-// CHECK-SAME: @"got.$s15resilient_class22ResilientOutsideParentCACycfCTq"
+// CHECK-SAME: @"{{got.|__imp_}}$s15resilient_class22ResilientOutsideParentCACycfCTq"
// -- implementation:
// CHECK-SAME: @"$s16class_resilience14ResilientChildCACycfC"
// CHECK-SAME: }
diff --git a/test/IRGen/dead_method.swift b/test/IRGen/dead_method.swift
index b6a2127..fd52c73 100644
--- a/test/IRGen/dead_method.swift
+++ b/test/IRGen/dead_method.swift
@@ -37,7 +37,7 @@
// CHECK-SAME: void (%T11dead_method5ClassC*)* @"$s11dead_method5ClassCfD",
// -- value witness table
-// CHECK-SAME: i8** @"$sBoWV",
+// CHECK-SAME: i8** {{@"\$sBoWV"|null}},
// -- nominal type descriptor
// CHECK-SAME: @"$s11dead_method5ClassCMn",
diff --git a/test/IRGen/generic_vtable.swift b/test/IRGen/generic_vtable.swift
index b84079d..48259c4 100644
--- a/test/IRGen/generic_vtable.swift
+++ b/test/IRGen/generic_vtable.swift
@@ -41,7 +41,7 @@
// -- destructor
// CHECK-SAME: void (%T14generic_vtable4BaseC*)* @"$s14generic_vtable4BaseCfD"
// -- value witness table
-// CHECK-SAME: i8** @"$sBoWV"
+// CHECK-SAME: i8** {{@"\$sBoWV"|null}}
// -- vtable entry for 'm1()'
// CHECK-SAME: void (%T14generic_vtable4BaseC*)* @"$s14generic_vtable4BaseC2m1yyF"
// -- vtable entry for 'm2()'
diff --git a/test/IRGen/ivar_destroyer.sil b/test/IRGen/ivar_destroyer.sil
index e339aa4..c700b3b 100644
--- a/test/IRGen/ivar_destroyer.sil
+++ b/test/IRGen/ivar_destroyer.sil
@@ -8,7 +8,7 @@
// CHECK-LABEL: @"$s14ivar_destroyer17NonTrivialDerivedCMf" = internal global <{ {{.*}} }> <{
// CHECK-SAME: i8* null,
-// CHECK-SAME: i8** @"$sBoWV",
+// CHECK-SAME: i8** {{@"\$sBoWV"|null}},
// CHECK-SAME: i64 ptrtoint ([[OBJCCLASS]]* @"$s14ivar_destroyer17NonTrivialDerivedCMm" to i64),
// CHECK-SAME: [[TYPE]]* bitcast (i64* getelementptr inbounds (<{ {{.*}} }>, <{ {{.*}} }>* @"$s14ivar_destroyer11TrivialBaseCMf", i32 0, i32 2) to [[TYPE]]*),
// CHECK-SAME: [[OPAQUE]]* @_objc_empty_cache,
diff --git a/test/IRGen/keypath_witness_overrides.swift b/test/IRGen/keypath_witness_overrides.swift
index 6649ee1..a2cc3f3 100644
--- a/test/IRGen/keypath_witness_overrides.swift
+++ b/test/IRGen/keypath_witness_overrides.swift
@@ -5,7 +5,7 @@
import protocol_overrides
// CHECK: @keypath = private global
-// CHECK-SAME: %swift.method_descriptor** @"got.$s18protocol_overrides14OriginalGetterPy7ElementQz5IndexQzcigTq"
+// CHECK-SAME: %swift.method_descriptor** @"{{got.|__imp_}}$s18protocol_overrides14OriginalGetterPy7ElementQz5IndexQzcigTq"
public func getWritableKeyPath<OS: OverridesSetter>(_ c: OS, index: OS.Index) -> AnyKeyPath
where OS.Index: Hashable {
let keypath = \OS.[index]
diff --git a/test/IRGen/keypaths.sil b/test/IRGen/keypaths.sil
index d71a08f..92838a8 100644
--- a/test/IRGen/keypaths.sil
+++ b/test/IRGen/keypaths.sil
@@ -157,7 +157,7 @@
// CHECK-SAME: <i32 0x8000_000c>,
// -- computed, get-only, identified by (indirected) function pointer, no args
// CHECK-SAME: <i32 0x0200_0002>,
-// CHECK-SAME: @got.k_id
+// CHECK-SAME: @{{got.|__imp_}}k_id
// CHECK-SAME: void (%TSi*, %T8keypaths1SV*)* @k_get
// -- %l: computed
@@ -169,7 +169,7 @@
// CHECK-SAME: <i32 0x8000_0010>,
// -- computed, settable, nonmutating, identified by indirect pointer, no args
// CHECK-SAME: <i32 0x0240_0002>,
-// CHECK-SAME: @"got.$s8keypaths1CC1wSivgTq"
+// CHECK-SAME: @"{{got.|__imp_}}$s8keypaths1CC1wSivgTq"
// CHECK-SAME: void (%TSi*, %T8keypaths1CC**)* @l_get
// CHECK-SAME: void (%TSi*, %T8keypaths1CC**)* @l_set
diff --git a/test/IRGen/keypaths_external.sil b/test/IRGen/keypaths_external.sil
index 3b06e79..813b711 100644
--- a/test/IRGen/keypaths_external.sil
+++ b/test/IRGen/keypaths_external.sil
@@ -41,13 +41,13 @@
sil @s_hash : $@convention(thin) <A: Hashable, B: Hashable> (UnsafeRawPointer) -> Int
// -- %t
-// CHECK: [[KP_T:@keypath(\..*)?]] = private global <{ {{.*}} }> <{ {{.*}} i32 1, {{.*}} @"got.$s23keypaths_external_other1GV1xxvpMV"
+// CHECK: [[KP_T:@keypath(\..*)?]] = private global <{ {{.*}} }> <{ {{.*}} i32 1, {{.*}} @"{{got.|__imp_}}$s23keypaths_external_other1GV1xxvpMV"
// CHECK-SAME: @"symbolic x"
// -- computed get-only property, identified by indirect pointer
// CHECK-SAME: <i32 0x0208_0002>
// -- %u
-// CHECK: [[KP_U:@keypath(\..*)?]] = private global <{ {{.*}} }> <{ {{.*}} i32 3, {{.*}} @"got.$s23keypaths_external_other1GVyxqd__cSHRd__luipMV"
+// CHECK: [[KP_U:@keypath(\..*)?]] = private global <{ {{.*}} }> <{ {{.*}} i32 3, {{.*}} @"{{got.|__imp_}}$s23keypaths_external_other1GVyxqd__cSHRd__luipMV"
// CHECK-SAME: @"symbolic q_"
// CHECK-SAME: @"symbolic x"
// CHECK-SAME: @"keypath_get_witness_table
diff --git a/test/IRGen/property_descriptor.sil b/test/IRGen/property_descriptor.sil
index 96da26f..d857113 100644
--- a/test/IRGen/property_descriptor.sil
+++ b/test/IRGen/property_descriptor.sil
@@ -54,7 +54,7 @@
// CHECK: @"$s19property_descriptor15ExternalGenericV10computedROxvpMV" =
// -- 0x0108_0000 - computed, readonly, has arguments, identified by indirect
// CHECK-SAME: <{ <i32 0x0208_0002>,
-// CHECK-SAME: @got.id_computed
+// CHECK-SAME: @{{got.|__imp_}}id_computed
// CHECK-SAME: [[GET_COMPUTEDRO:@keypath_get[.0-9]*]]
// CHECK-SAME: [[GET_ARG_LAYOUT_COMPUTEDRO:@keypath_get_arg_layout[.0-9]*]]
// -- default witness table
@@ -68,7 +68,7 @@
// CHECK: @"$s19property_descriptor15ExternalGenericV10computedRWxvpMV" =
// -- 0x01c8_0000 - computed, settable, mutating, has arguments, indirect id
// CHECK-SAME: <{ <i32 0x02c8_0002>,
-// CHECK-SAME: @got.id_computed
+// CHECK-SAME: @{{got.|__imp_}}id_computed
// CHECK-SAME: [[GET_COMPUTEDRW:@keypath_get[.0-9]*]]
// CHECK-SAME: [[SET_COMPUTEDRW:@keypath_set[.0-9]*]]
// CHECK-SAME: [[GET_ARG_LAYOUT_COMPUTEDRW:@keypath_get_arg_layout[.0-9]*]]
@@ -83,7 +83,7 @@
// CHECK: @"$s19property_descriptor15ExternalGenericVyxqd__cSHRd__luipMV" =
// -- 0x01c8_0000 - computed, settable, mutating, has arguments, indirect id
// CHECK-SAME: <{ <i32 0x02c8_0002>,
-// CHECK-SAME: @got.id_computed
+// CHECK-SAME: @{{got.|__imp_}}id_computed
// CHECK-SAME: [[GET_SUBSCRIPT:@keypath_get[.0-9]*]]
// CHECK-SAME: [[SET_SUBSCRIPT:@keypath_set[.0-9]*]]
// CHECK-SAME: [[GET_ARG_LAYOUT_SUBSCRIPT:@keypath_get_arg_layout[.0-9]*]]
diff --git a/test/IRGen/protocol_resilience_descriptors.swift b/test/IRGen/protocol_resilience_descriptors.swift
index 8820e69..98e6582 100644
--- a/test/IRGen/protocol_resilience_descriptors.swift
+++ b/test/IRGen/protocol_resilience_descriptors.swift
@@ -18,7 +18,7 @@
// CHECK: @"default assoc type \01____y2T118resilient_protocol29ProtocolWithAssocTypeDefaultsPQzG 18resilient_protocol7WrapperV" =
// Protocol descriptor
-// CHECK-DEFINITION-LABEL: @"$s18resilient_protocol29ProtocolWithAssocTypeDefaultsMp" ={{( protected)?}} constant
+// CHECK-DEFINITION-LABEL: @"$s18resilient_protocol29ProtocolWithAssocTypeDefaultsMp" ={{( dllexport)?}}{{( protected)?}} constant
// CHECK-DEFINITION-SAME: @"default associated conformance2T218resilient_protocol29ProtocolWithAssocTypeDefaultsP_AB014OtherResilientD0"
// Associated type default + flags
diff --git a/test/IRGen/subclass.swift b/test/IRGen/subclass.swift
index b8af411..75463fb 100644
--- a/test/IRGen/subclass.swift
+++ b/test/IRGen/subclass.swift
@@ -13,7 +13,7 @@
// CHECK: @_DATA__TtC8subclass1A = private constant {{.* } }}{
// CHECK: @"$s8subclass1ACMf" = internal global [[A_METADATA:<{.* }>]] <{
// CHECK-SAME: void ([[A]]*)* @"$s8subclass1ACfD",
-// CHECK-SAME: i8** @"$sBoWV",
+// CHECK-SAME: i8** {{@"\$sBoWV"|null}},
// CHECK-SAME: i64 ptrtoint ([[OBJC_CLASS]]* @"$s8subclass1ACMm" to i64),
// CHECK-SAME: [[OBJC_CLASS]]* @"OBJC_CLASS_$_{{(_TtCs12_)?}}SwiftObject",
// CHECK-SAME: [[OPAQUE]]* @_objc_empty_cache,
@@ -25,7 +25,7 @@
// CHECK: @_DATA__TtC8subclass1B = private constant {{.* } }}{
// CHECK: @"$s8subclass1BCMf" = internal global <{ {{.*}} }> <{
// CHECK-SAME: void ([[B]]*)* @"$s8subclass1BCfD",
-// CHECK-SAME: i8** @"$sBoWV",
+// CHECK-SAME: i8** {{@"\$sBoWV"|null}},
// CHECK-SAME: i64 ptrtoint ([[OBJC_CLASS]]* @"$s8subclass1BCMm" to i64),
// CHECK-SAME: [[TYPE]]* {{.*}} @"$s8subclass1ACMf",
// CHECK-SAME: [[OPAQUE]]* @_objc_empty_cache,
diff --git a/test/IRGen/vtable.sil b/test/IRGen/vtable.sil
index cf1c42f..73847ab 100644
--- a/test/IRGen/vtable.sil
+++ b/test/IRGen/vtable.sil
@@ -20,7 +20,7 @@
// CHECK-objc: @"$s6vtable1CCMf" = internal global [[C_METADATA_T:<{.*\* }>]] <{
// CHECK-objc: void ([[C]]*)* @"$s6vtable1CCfD",
-// CHECK-objc: i8** @"$sBoWV",
+// CHECK-objc: i8** {{@"\$sBoWV"|null}},
// CHECK-objc: i64 ptrtoint (%objc_class* @"$s6vtable1CCMm" to i64),
// CHECK-objc: %objc_class* @"OBJC_CLASS_$_{{(_TtCs12_)?}}SwiftObject",
// CHECK-objc: %swift.opaque* @_objc_empty_cache,
@@ -34,7 +34,7 @@
// CHECK-native: @"$s6vtable1CCMf" = internal global [[C_METADATA_T:<{.*\* }>]] <{
// CHECK-native: void ([[C]]*)* @"$s6vtable1CCfD",
-// CHECK-native: i8** @"$sBoWV",
+// CHECK-native: i8** {{@"\$sBoWV"|null}},
// CHECK-native: i64 0,
// CHECK-native: %swift.type* null,
// CHECK-native: %swift.opaque* null,
diff --git a/test/IRGen/vtable_symbol_linkage.swift b/test/IRGen/vtable_symbol_linkage.swift
index 9191384..dea03b0 100644
--- a/test/IRGen/vtable_symbol_linkage.swift
+++ b/test/IRGen/vtable_symbol_linkage.swift
@@ -1,10 +1,10 @@
// RUN: %empty-directory(%t)
-// RUN: %target-build-swift %S/Inputs/vtable_symbol_linkage_base.swift -emit-module -emit-module-path=%t/BaseModule.swiftmodule -emit-library -module-name BaseModule -o %t/BaseModule%{target-shared-library-suffix}
-// RUN: %target-build-swift -I %t %s %t/BaseModule%{target-shared-library-suffix} -o %t/a.out
+// RUN: %target-build-swift %S/Inputs/vtable_symbol_linkage_base.swift -emit-module -emit-module-path=%t/BaseModule.swiftmodule -emit-library -module-name BaseModule -o %t/%target-library-name(BaseModule)
+// RUN: %target-build-swift -I %t %s -o %t/a.out -L%t -lBaseModule
-// RUN: %target-build-swift %S/Inputs/vtable_symbol_linkage_base.swift -emit-module -emit-module-path=%t/BaseModule.swiftmodule -emit-library -module-name BaseModule -o %t/BaseModule%{target-shared-library-suffix} -Xfrontend -enable-resilience -Xfrontend -enable-class-resilience
-// RUN: %target-build-swift -I %t %s %t/BaseModule%{target-shared-library-suffix} -o %t/a.out -Xfrontend -enable-class-resilience
+// RUN: %target-build-swift %S/Inputs/vtable_symbol_linkage_base.swift -emit-module -emit-module-path=%t/BaseModule.swiftmodule -emit-library -module-name BaseModule -o %t/%target-library-name(BaseModule) -Xfrontend -enable-resilience -Xfrontend -enable-class-resilience
+// RUN: %target-build-swift -I %t %s -o %t/a.out -Xfrontend -enable-class-resilience -L%t -lBaseModule
// Check if the program can be linked without undefined symbol errors.
diff --git a/test/Migrator/rename.swift b/test/Migrator/rename.swift
index 1f66e5b..2b9ca6e 100644
--- a/test/Migrator/rename.swift
+++ b/test/Migrator/rename.swift
@@ -1,5 +1,5 @@
// REQUIRES: objc_interop
-// RUN: %empty-directory(%t) && %target-swift-frontend -c -update-code -primary-file %s -F %S/mock-sdk -api-diff-data-file %S/Inputs/API.json -emit-migrated-file-path %t/rename.swift.result -emit-remap-file-path %t/rename.swift.remap -o /dev/null
+// RUN: %empty-directory(%t) && %target-swift-frontend -c -update-code -primary-file %s -F %S/mock-sdk -api-diff-data-file %S/Inputs/API.json -emit-migrated-file-path %t/rename.swift.result -emit-remap-file-path %t/rename.swift.remap -o /dev/null -disable-migrator-fixits
// RUN: diff -u %S/rename.swift.expected %t/rename.swift.result
import Bar
diff --git a/test/Migrator/rename.swift.expected b/test/Migrator/rename.swift.expected
index a19c26d..7f0670e 100644
--- a/test/Migrator/rename.swift.expected
+++ b/test/Migrator/rename.swift.expected
@@ -1,5 +1,5 @@
// REQUIRES: objc_interop
-// RUN: %empty-directory(%t) && %target-swift-frontend -c -update-code -primary-file %s -F %S/mock-sdk -api-diff-data-file %S/Inputs/API.json -emit-migrated-file-path %t/rename.swift.result -emit-remap-file-path %t/rename.swift.remap -o /dev/null
+// RUN: %empty-directory(%t) && %target-swift-frontend -c -update-code -primary-file %s -F %S/mock-sdk -api-diff-data-file %S/Inputs/API.json -emit-migrated-file-path %t/rename.swift.result -emit-remap-file-path %t/rename.swift.remap -o /dev/null -disable-migrator-fixits
// RUN: diff -u %S/rename.swift.expected %t/rename.swift.result
import Bar
@@ -16,7 +16,7 @@
b.barNewInstanceFunc1(newlabel1: 0, newlabel2: 1, newlabel3: 2, newlabel4: 3)
barGlobalFuncNewName(newlabel: 2)
_ = NewEnum.enumElement
- _ = PropertyUserInterface.newMethodPlus()
+ _ = PropertyUserInterface.newMethodPlus()!
let _: BarBase.Nested
_ = AwesomeWrapper.newName(is: 0, at: 1, for: 2)
}
diff --git a/test/Migrator/stdlib_rename.swift b/test/Migrator/stdlib_rename.swift
index 20397f3..d5ae2b3 100644
--- a/test/Migrator/stdlib_rename.swift
+++ b/test/Migrator/stdlib_rename.swift
@@ -6,6 +6,7 @@
func test1(_ a: [String], s: String) {
_ = a.index(of: s)
+ _ = a.index(where: { _ in true })
}
func test2(_ s: String, c: Character) {
_ = s.index(of: c)
diff --git a/test/Migrator/stdlib_rename.swift.expected b/test/Migrator/stdlib_rename.swift.expected
index f721bf8..04dadba 100644
--- a/test/Migrator/stdlib_rename.swift.expected
+++ b/test/Migrator/stdlib_rename.swift.expected
@@ -6,6 +6,7 @@
func test1(_ a: [String], s: String) {
_ = a.firstIndex(of: s)
+ _ = a.firstIndex(where: { _ in true })
}
func test2(_ s: String, c: Character) {
_ = s.firstIndex(of: c)
diff --git a/test/ParseableInterface/ModuleCache/force-module-loading-mode-archs.swift b/test/ParseableInterface/ModuleCache/force-module-loading-mode-archs.swift
index 7e105c3..195b4c1 100644
--- a/test/ParseableInterface/ModuleCache/force-module-loading-mode-archs.swift
+++ b/test/ParseableInterface/ModuleCache/force-module-loading-mode-archs.swift
@@ -10,7 +10,7 @@
// 2. Only interface is present.
// RUN: %empty-directory(%t/Lib.swiftmodule)
-// RUN: cp %S/Inputs/force-module-loading-mode/Lib.swiftinterface %t/Lib.swiftmodule/$(basename %target-swiftmodule-name .swiftmodule).swiftinterface
+// RUN: cp %S/Inputs/force-module-loading-mode/Lib.swiftinterface %t/Lib.swiftmodule/%target-cpu.swiftinterface
// RUN: not env SWIFT_FORCE_MODULE_LOADING=prefer-parseable %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -I %t 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
// RUN: not env SWIFT_FORCE_MODULE_LOADING=prefer-serialized %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -I %t 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
// RUN: not env SWIFT_FORCE_MODULE_LOADING=only-parseable %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -I %t 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
@@ -29,7 +29,7 @@
// RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -I %t %s 2>&1 | %FileCheck -check-prefix=FROM-SERIALIZED %s
// 4. Both are present.
-// RUN: cp %S/Inputs/force-module-loading-mode/Lib.swiftinterface %t/Lib.swiftmodule/$(basename %target-swiftmodule-name .swiftmodule).swiftinterface
+// RUN: cp %S/Inputs/force-module-loading-mode/Lib.swiftinterface %t/Lib.swiftmodule/%target-cpu.swiftinterface
// RUN: not env SWIFT_FORCE_MODULE_LOADING=prefer-parseable %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -I %t 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
// RUN: not env SWIFT_FORCE_MODULE_LOADING=prefer-serialized %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -I %t 2>&1 | %FileCheck -check-prefix=FROM-SERIALIZED %s
// RUN: not env SWIFT_FORCE_MODULE_LOADING=only-parseable %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -I %t 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
@@ -59,12 +59,12 @@
// RUN: %empty-directory(%t/Lib.swiftmodule)
// RUN: touch %t/Lib.swiftmodule/garbage.swiftmodule
// RUN: touch %t/Lib.swiftmodule/garbage.swiftinterface
-// RUN: not env SWIFT_FORCE_MODULE_LOADING=prefer-parseable %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -I %t 2>&1 | %FileCheck -check-prefix=WRONG-ARCH -DARCH=$(basename %target-swiftmodule-name .swiftmodule) %s
-// RUN: not env SWIFT_FORCE_MODULE_LOADING=prefer-serialized %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -I %t 2>&1 | %FileCheck -check-prefix=WRONG-ARCH -DARCH=$(basename %target-swiftmodule-name .swiftmodule) %s
+// RUN: not env SWIFT_FORCE_MODULE_LOADING=prefer-parseable %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -I %t 2>&1 | %FileCheck -check-prefix=WRONG-ARCH -DARCH=%target-cpu %s
+// RUN: not env SWIFT_FORCE_MODULE_LOADING=prefer-serialized %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -I %t 2>&1 | %FileCheck -check-prefix=WRONG-ARCH -DARCH=%target-cpu %s
// RUN: not env SWIFT_FORCE_MODULE_LOADING=only-parseable %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -I %t 2>&1 | %FileCheck -check-prefix=NO-SUCH-MODULE %s
-// RUN: not env SWIFT_FORCE_MODULE_LOADING=only-serialized %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -I %t 2>&1 | %FileCheck -check-prefix=WRONG-ARCH -DARCH=$(basename %target-swiftmodule-name .swiftmodule) %s
+// RUN: not env SWIFT_FORCE_MODULE_LOADING=only-serialized %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -I %t 2>&1 | %FileCheck -check-prefix=WRONG-ARCH -DARCH=%target-cpu %s
// (default)
-// RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -I %t %s 2>&1 | %FileCheck -check-prefix=WRONG-ARCH -DARCH=$(basename %target-swiftmodule-name .swiftmodule) %s
+// RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -I %t %s 2>&1 | %FileCheck -check-prefix=WRONG-ARCH -DARCH=%target-cpu %s
// 8. Only the interface is present but for the wrong architecture.
// (Diagnostics for the module only are tested elsewhere.)
diff --git a/test/ParseableInterface/ModuleCache/force-module-loading-mode-framework.swift b/test/ParseableInterface/ModuleCache/force-module-loading-mode-framework.swift
index 6e40bdd..b1f0d5c 100644
--- a/test/ParseableInterface/ModuleCache/force-module-loading-mode-framework.swift
+++ b/test/ParseableInterface/ModuleCache/force-module-loading-mode-framework.swift
@@ -10,7 +10,7 @@
// 2. Only interface is present.
// RUN: %empty-directory(%t/Lib.framework/Modules/Lib.swiftmodule)
-// RUN: cp %S/Inputs/force-module-loading-mode/Lib.swiftinterface %t/Lib.framework/Modules/Lib.swiftmodule/$(basename %target-swiftmodule-name .swiftmodule).swiftinterface
+// RUN: cp %S/Inputs/force-module-loading-mode/Lib.swiftinterface %t/Lib.framework/Modules/Lib.swiftmodule/%target-cpu.swiftinterface
// RUN: not env SWIFT_FORCE_MODULE_LOADING=prefer-parseable %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -F %t 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
// RUN: not env SWIFT_FORCE_MODULE_LOADING=prefer-serialized %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -F %t 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
// RUN: not env SWIFT_FORCE_MODULE_LOADING=only-parseable %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -F %t 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
@@ -29,7 +29,7 @@
// RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -F %t %s 2>&1 | %FileCheck -check-prefix=FROM-SERIALIZED %s
// 4. Both are present.
-// RUN: cp %S/Inputs/force-module-loading-mode/Lib.swiftinterface %t/Lib.framework/Modules/Lib.swiftmodule/$(basename %target-swiftmodule-name .swiftmodule).swiftinterface
+// RUN: cp %S/Inputs/force-module-loading-mode/Lib.swiftinterface %t/Lib.framework/Modules/Lib.swiftmodule/%target-cpu.swiftinterface
// RUN: not env SWIFT_FORCE_MODULE_LOADING=prefer-parseable %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -F %t 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
// RUN: not env SWIFT_FORCE_MODULE_LOADING=prefer-serialized %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -F %t 2>&1 | %FileCheck -check-prefix=FROM-SERIALIZED %s
// RUN: not env SWIFT_FORCE_MODULE_LOADING=only-parseable %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -F %t 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
@@ -59,12 +59,12 @@
// RUN: %empty-directory(%t/Lib.framework/Modules/Lib.swiftmodule)
// RUN: touch %t/Lib.framework/Modules/Lib.swiftmodule/garbage.swiftmodule
// RUN: touch %t/Lib.framework/Modules/Lib.swiftmodule/garbage.swiftinterface
-// RUN: not env SWIFT_FORCE_MODULE_LOADING=prefer-parseable %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -F %t 2>&1 | %FileCheck -check-prefix=WRONG-ARCH -DARCH=$(basename %target-swiftmodule-name .swiftmodule) %s
-// RUN: not env SWIFT_FORCE_MODULE_LOADING=prefer-serialized %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -F %t 2>&1 | %FileCheck -check-prefix=WRONG-ARCH -DARCH=$(basename %target-swiftmodule-name .swiftmodule) %s
+// RUN: not env SWIFT_FORCE_MODULE_LOADING=prefer-parseable %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -F %t 2>&1 | %FileCheck -check-prefix=WRONG-ARCH -DARCH=%target-cpu %s
+// RUN: not env SWIFT_FORCE_MODULE_LOADING=prefer-serialized %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -F %t 2>&1 | %FileCheck -check-prefix=WRONG-ARCH -DARCH=%target-cpu %s
// RUN: not env SWIFT_FORCE_MODULE_LOADING=only-parseable %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -F %t 2>&1 | %FileCheck -check-prefix=NO-SUCH-MODULE %s
-// RUN: not env SWIFT_FORCE_MODULE_LOADING=only-serialized %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -F %t 2>&1 | %FileCheck -check-prefix=WRONG-ARCH -DARCH=$(basename %target-swiftmodule-name .swiftmodule) %s
+// RUN: not env SWIFT_FORCE_MODULE_LOADING=only-serialized %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -F %t 2>&1 | %FileCheck -check-prefix=WRONG-ARCH -DARCH=%target-cpu %s
// (default)
-// RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -F %t %s 2>&1 | %FileCheck -check-prefix=WRONG-ARCH -DARCH=$(basename %target-swiftmodule-name .swiftmodule) %s
+// RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -F %t %s 2>&1 | %FileCheck -check-prefix=WRONG-ARCH -DARCH=%target-cpu %s
// 8. Only the interface is present but for the wrong architecture.
// (Diagnostics for the module only are tested elsewhere.)
diff --git a/test/ParseableInterface/ModuleCache/prebuilt-module-cache-archs.swift b/test/ParseableInterface/ModuleCache/prebuilt-module-cache-archs.swift
index e8ce6e1..06b5aa7 100644
--- a/test/ParseableInterface/ModuleCache/prebuilt-module-cache-archs.swift
+++ b/test/ParseableInterface/ModuleCache/prebuilt-module-cache-archs.swift
@@ -1,6 +1,6 @@
// RUN: %empty-directory(%t)
// RUN: %empty-directory(%t/include/Lib.swiftmodule)
-// RUN: cp %S/Inputs/prebuilt-module-cache/Lib.swiftinterface %t/include/Lib.swiftmodule/$(basename %target-swiftmodule-name .swiftmodule).swiftinterface
+// RUN: cp %S/Inputs/prebuilt-module-cache/Lib.swiftinterface %t/include/Lib.swiftmodule/%target-cpu.swiftinterface
// Baseline check: if the prebuilt cache path does not exist, everything should
// still work.
diff --git a/test/ParseableInterface/ModuleCache/swiftdoc-next-to-swiftinterface.swift b/test/ParseableInterface/ModuleCache/swiftdoc-next-to-swiftinterface.swift
index 230014b..03c4dc2 100644
--- a/test/ParseableInterface/ModuleCache/swiftdoc-next-to-swiftinterface.swift
+++ b/test/ParseableInterface/ModuleCache/swiftdoc-next-to-swiftinterface.swift
@@ -10,7 +10,7 @@
// Try again with architecture-specific subdirectories.
// RUN: %empty-directory(%t)
// RUN: %empty-directory(%t/Lib.swiftmodule)
-// RUN: %target-swift-frontend -emit-module -emit-parseable-module-interface-path %t/Lib.swiftmodule/$(basename %target-swiftmodule-name .swiftmodule).swiftinterface -emit-module-doc -parse-stdlib -o %t/Lib.swiftmodule/%target-swiftmodule-name -module-name Lib %s
+// RUN: %target-swift-frontend -emit-module -emit-parseable-module-interface-path %t/Lib.swiftmodule/%target-cpu.swiftinterface -emit-module-doc -parse-stdlib -o %t/Lib.swiftmodule/%target-swiftmodule-name -module-name Lib %s
// RUN: %target-swift-ide-test -print-module -module-to-print=Lib -access-filter-public -I %t -source-filename=x > %t/from-module.txt
// RUN: %FileCheck %s < %t/from-module.txt
diff --git a/test/SILOptimizer/pointer_conversion.swift b/test/SILOptimizer/pointer_conversion.swift
index 1b0d1af..5752c64 100644
--- a/test/SILOptimizer/pointer_conversion.swift
+++ b/test/SILOptimizer/pointer_conversion.swift
@@ -84,17 +84,17 @@
// CHECK-LABEL: sil @$s18pointer_conversion21arrayLiteralPromotionyyF
public func arrayLiteralPromotion() {
- takesConstRawPointer([41,42,43,44])
+ takesConstRawPointer([-41,-42,-43,-44])
// Stack allocate the array.
// TODO: When stdlib checks are enabled, this becomes heap allocated... :-(
// CHECK: alloc_ref {{.*}}[tail_elems $Int * {{.*}} : $Builtin.Word] $_ContiguousArrayStorage<Int>
// Store the elements.
- // CHECK: [[ELT:%.+]] = integer_literal $Builtin.Int{{.*}}, 41
- // CHECK: [[ELT:%.+]] = integer_literal $Builtin.Int{{.*}}, 42
- // CHECK: [[ELT:%.+]] = integer_literal $Builtin.Int{{.*}}, 43
- // CHECK: [[ELT:%.+]] = integer_literal $Builtin.Int{{.*}}, 44
+ // CHECK: [[ELT:%.+]] = integer_literal $Builtin.Int{{.*}}, -41
+ // CHECK: [[ELT:%.+]] = integer_literal $Builtin.Int{{.*}}, -42
+ // CHECK: [[ELT:%.+]] = integer_literal $Builtin.Int{{.*}}, -43
+ // CHECK: [[ELT:%.+]] = integer_literal $Builtin.Int{{.*}}, -44
// Call the function.
// CHECK: [[PTR:%.+]] = mark_dependence
diff --git a/test/Syntax/Inputs/invalid.sed b/test/Syntax/Inputs/invalid.sed
new file mode 100644
index 0000000..41894dd
--- /dev/null
+++ b/test/Syntax/Inputs/invalid.sed
@@ -0,0 +1,32 @@
+
+# [0xC2] is utf8 2 byte character start byte.
+# 0xC2 without second byte is invalid UTF-8 sequence.
+# It becomes garbage text trivia.
+# Marker(1) is replaced to this sequence.
+s/Z1/Â/g
+
+# [0xCC, 0x82] in UTF-8 is U+0302.
+# This character is invalid for identifier start, but valid for identifier body.
+# It becomes unknown token.
+# If this type characters are conitguous, they are concatenated to one long unknown token.
+# Marker(2) is replaced to this sequence.
+s/Z2/̂/g
+
+# [0xE2, 0x80, 0x9C] in UTF-8 is U+201C, left quote.
+# It becomes single character unknown token.
+# If this left quote and right quote enclosure text,
+# they become one long unknown token.
+# Marker(3) is replaced to this sequence.
+s/Z3/“/g
+
+# [0xE2, 0x80, 0x9D] in UTF-8 is U+201D, right quote.
+# It becomes single character unknown token.
+# Marker(4) is replaced to this sequence.
+s/Z4/”/g
+
+# [0xE1, 0x9A, 0x80] in UTF-8 is U+1680.
+# This character is invalid for swift source.
+# It becomes garbage trivia.
+# Marker(5) is replaced to this sequence.
+s/Z5/ /g
+
diff --git a/test/Syntax/Inputs/nbsp.sed b/test/Syntax/Inputs/nbsp.sed
new file mode 100644
index 0000000..3d9adf5
--- /dev/null
+++ b/test/Syntax/Inputs/nbsp.sed
@@ -0,0 +1 @@
+s/Z/ /g
diff --git a/test/Syntax/tokens_nonbreaking_space.swift b/test/Syntax/tokens_nonbreaking_space.swift
index 97cd258..b0da4ce 100644
--- a/test/Syntax/tokens_nonbreaking_space.swift
+++ b/test/Syntax/tokens_nonbreaking_space.swift
@@ -1,4 +1,4 @@
-// RUN: cat %s | sed -e 's/'$(echo -ne "\x5a")'/'$(echo -ne "\xc2\xa0")'/g' > %t.tmp
+// RUN: cat %s | sed -f %S/Inputs/nbsp.sed > %t.tmp
// RUN: cp -f %t.tmp %t
// RUN: %swift-syntax-test -input-source-filename %t -dump-full-tokens 2>&1 | %FileCheck %t
let a =Z3Z // nbsp(Z)
diff --git a/test/Syntax/tokens_unknown_and_invalid.swift b/test/Syntax/tokens_unknown_and_invalid.swift
index 98be090..3a5cb16 100644
--- a/test/Syntax/tokens_unknown_and_invalid.swift
+++ b/test/Syntax/tokens_unknown_and_invalid.swift
@@ -5,46 +5,8 @@
// To avoid replace marker in sed command by sed itself,
// marker is also represented in escape sequence.
-// RUN: cat %s | sed \
-
-// [0xC2] is utf8 2 byte character start byte.
-// 0xC2 without second byte is invalid UTF-8 sequence.
-// It becomes garbage text trivia.
-// Marker(1) is replaced to this sequence.
-
-// RUN: -e 's/'$(echo -ne "\x5a1")'/'$(echo -ne "\xc2")'/g' \
-
-// [0xCC, 0x82] in UTF-8 is U+0302.
-// This character is invalid for identifier start, but valid for identifier body.
-// It becomes unknown token.
-// If this type characters are conitguous, they are concatenated to one long unknown token.
-// Marker(2) is replaced to this sequence.
-
-// RUN: -e 's/'$(echo -ne "\x5a2")'/'$(echo -ne "\xcc\x82")'/g' \
-
-// [0xE2, 0x80, 0x9C] in UTF-8 is U+201C, left quote.
-// It becomes single character unknown token.
-// If this left quote and right quote enclosure text,
-// they become one long unknown token.
-// Marker(3) is replaced to this sequence.
-
-// RUN: -e 's/'$(echo -ne "\x5a3")'/'$(echo -ne "\xe2\x80\x9c")'/g' \
-
-// [0xE2, 0x80, 0x9D] in UTF-8 is U+201D, right quote.
-// It becomes single character unknown token.
-// Marker(4) is replaced to this sequence.
-
-// RUN: -e 's/'$(echo -ne "\x5a4")'/'$(echo -ne "\xe2\x80\x9d")'/g' \
-
-// [0xE1, 0x9A, 0x80] in UTF-8 is U+1680.
-// This character is invalid for swift source.
-// It becomes garbage trivia.
-// Marker(5) is replaced to this sequence.
-
-// RUN: -e 's/'$(echo -ne "\x5a5")'/'$(echo -ne "\xe1\x9a\x80")'/g' \
-
-// RUN: > %t
-
+// RUN: cat %s | sed -f %S/Inputs/invalid.sed > %t
+// RUN: %{python} -c "import sys; t = open(sys.argv[1], 'rb').read().replace('\r\n', '\n'); open(sys.argv[1], 'wb').write(t)" %t
// RUN: %swift-syntax-test -input-source-filename %t -dump-full-tokens 2>&1 | %FileCheck %t
// RUN: %round-trip-syntax-test --swift-syntax-test %swift-syntax-test --file %t
@@ -66,20 +28,20 @@
jjj
// Diagnostics
-// CHECK: 52:1: error: invalid UTF-8 found in source file
-// CHECK: 52:7: error: invalid UTF-8 found in source file
-// CHECK: 54:5: error: an identifier cannot begin with this character
-// CHECK: 56:5: error: an identifier cannot begin with this character
-// CHECK: 58:5: error: unicode curly quote found
-// CHECK: 58:8: error: unicode curly quote found
-// CHECK: 60:19: error: unicode curly quote found
-// CHECK: 60:5: error: unicode curly quote found
-// CHECK: 62:5: error: unicode curly quote found
-// CHECK: 65:1: error: invalid character in source file
-// CHECK: 65:9: error: invalid character in source file
+// CHECK: 14:1: error: invalid UTF-8 found in source file
+// CHECK: 14:7: error: invalid UTF-8 found in source file
+// CHECK: 16:5: error: an identifier cannot begin with this character
+// CHECK: 18:5: error: an identifier cannot begin with this character
+// CHECK: 20:5: error: unicode curly quote found
+// CHECK: 20:8: error: unicode curly quote found
+// CHECK: 22:19: error: unicode curly quote found
+// CHECK: 22:5: error: unicode curly quote found
+// CHECK: 24:5: error: unicode curly quote found
+// CHECK: 27:1: error: invalid character in source file
+// CHECK: 27:9: error: invalid character in source file
// Checks around bbb
-// CHECK-LABEL: 52:3
+// CHECK-LABEL: 14:3
// CHECK-NEXT: (Token identifier
// CHECK-NEXT: (trivia newline 1)
// CHECK-NEXT: (trivia garbageText \302)
@@ -89,35 +51,35 @@
// CHECK-NEXT: (trivia garbageText \302))
// Checks around ccc
-// CHECK-LABEL: 54:5
+// CHECK-LABEL: 16:5
// CHECK-NEXT: (Token unknown
// CHECK-NEXT: (text="\xCC\x82"))
// Checks around ddd
-// CHECK-LABEL: 56:5
+// CHECK-LABEL: 18:5
// CHECK-NEXT: (Token unknown
// CHECK-NEXT: (text="\xCC\x82\xCC\x82\xCC\x82\xCC\x82"))
// Checks around eee
-// CHECK-LABEL: 58:5
+// CHECK-LABEL: 20:5
// CHECK-NEXT: (Token unknown
// CHECK-NEXT: (text="\xE2\x80\x9C"))
-// CHECK-LABEL: 58:8
+// CHECK-LABEL: 20:8
// CHECK-NEXT: (Token unknown
// CHECK-NEXT: (text="\xE2\x80\x9C"))
// Checks around fff
-// CHECK-LABEL: 60:5
+// CHECK-LABEL: 22:5
// CHECK-NEXT: (Token unknown
// CHECK-NEXT: (text="\xE2\x80\x9Chello world\xE2\x80\x9D"))
// Checks around ggg
-// CHECK-LABEL: 62:5
+// CHECK-LABEL: 24:5
// CHECK-NEXT: (Token unknown
// CHECK-NEXT: (text="\xE2\x80\x9D"))
// Checks around iii
-// CHECK-LABEL: 65:5
+// CHECK-LABEL: 27:5
// CHECK-NEXT: (Token identifier
// CHECK-NEXT: (trivia newline 1)
// CHECK-NEXT: (trivia garbageText \341\232\200)
diff --git a/test/api-digester/Outputs/stability-stdlib-abi.swift.expected b/test/api-digester/Outputs/stability-stdlib-abi.swift.expected
index e6df12d..f8a2ab1 100644
--- a/test/api-digester/Outputs/stability-stdlib-abi.swift.expected
+++ b/test/api-digester/Outputs/stability-stdlib-abi.swift.expected
@@ -28,3 +28,46 @@
Var _StringObject._countAndFlags is no longer a stored property
Var _StringObject._countAndFlagsBits is added to a non-resilient type
+
+Class _DictionaryStorage has changed its super class from _RawDictionaryStorage to __RawDictionaryStorage
+Class _EmptyDictionarySingleton has been renamed to Class __EmptyDictionarySingleton
+Class _EmptyDictionarySingleton has changed its super class from _RawDictionaryStorage to __RawDictionaryStorage
+Class _EmptySetSingleton has been renamed to Class __EmptySetSingleton
+Class _EmptySetSingleton has changed its super class from _RawSetStorage to __RawSetStorage
+Class _RawDictionaryStorage has been renamed to Class __RawDictionaryStorage
+Class _RawSetStorage has been renamed to Class __RawSetStorage
+Class _SetStorage has changed its super class from _RawSetStorage to __RawSetStorage
+Constructor Dictionary._Variant.init(cocoa:) has parameter 0 type change from _CocoaDictionary to __CocoaDictionary
+Constructor Dictionary.init(_cocoa:) has parameter 0 type change from _CocoaDictionary to __CocoaDictionary
+Constructor Set._Variant.init(cocoa:) has parameter 0 type change from _CocoaSet to __CocoaSet
+Constructor Set.init(_cocoa:) has parameter 0 type change from _CocoaSet to __CocoaSet
+Constructor _CocoaDictionary.init(_:) has return type change from _CocoaDictionary to __CocoaDictionary
+Constructor _CocoaSet.init(_:) has return type change from _CocoaSet to __CocoaSet
+Constructor _NativeDictionary.init(_:) has parameter 0 type change from _CocoaDictionary to __CocoaDictionary
+Constructor _NativeDictionary.init(_:) has parameter 0 type change from _RawDictionaryStorage to __RawDictionaryStorage
+Constructor _NativeDictionary.init(_:capacity:) has parameter 0 type change from _CocoaDictionary to __CocoaDictionary
+Constructor _NativeSet.init(_:) has parameter 0 type change from _CocoaSet to __CocoaSet
+Constructor _NativeSet.init(_:) has parameter 0 type change from _RawSetStorage to __RawSetStorage
+Constructor _NativeSet.init(_:capacity:) has parameter 0 type change from _CocoaSet to __CocoaSet
+Func Set._Variant._migrateToNative(_:removing:) has parameter 0 type change from _CocoaSet to __CocoaSet
+Func _CocoaDictionary.isEqual(to:) has parameter 0 type change from _CocoaDictionary to __CocoaDictionary
+Func _CocoaSet.isEqual(to:) has parameter 0 type change from _CocoaSet to __CocoaSet
+Func _DictionaryStorage.convert(_:capacity:) has parameter 0 type change from _CocoaDictionary to __CocoaDictionary
+Func _DictionaryStorage.copy(original:) has parameter 0 type change from _RawDictionaryStorage to __RawDictionaryStorage
+Func _DictionaryStorage.resize(original:capacity:move:) has parameter 0 type change from _RawDictionaryStorage to __RawDictionaryStorage
+Func _NativeDictionary.isEqual(to:) has parameter 0 type change from _CocoaDictionary to __CocoaDictionary
+Func _NativeSet.isEqual(to:) has parameter 0 type change from _CocoaSet to __CocoaSet
+Func _SetStorage.convert(_:capacity:) has parameter 0 type change from _CocoaSet to __CocoaSet
+Func _SetStorage.copy(original:) has parameter 0 type change from _RawSetStorage to __RawSetStorage
+Func _SetStorage.resize(original:capacity:move:) has parameter 0 type change from _RawSetStorage to __RawSetStorage
+Struct _CocoaDictionary has been renamed to Struct __CocoaDictionary
+Struct _CocoaSet has been renamed to Struct __CocoaSet
+Var Dictionary._Variant.asCocoa has declared type change from _CocoaDictionary to __CocoaDictionary
+Var Dictionary._Variant.object has declared type change from _BridgeStorage<_RawDictionaryStorage> to _BridgeStorage<__RawDictionaryStorage>
+Var Set._Variant.asCocoa has declared type change from _CocoaSet to __CocoaSet
+Var Set._Variant.object has declared type change from _BridgeStorage<_RawSetStorage> to _BridgeStorage<__RawSetStorage>
+Var _CocoaDictionary.Index.dictionary has declared type change from _CocoaDictionary to __CocoaDictionary
+Var _NativeDictionary._storage has declared type change from _RawDictionaryStorage to __RawDictionaryStorage
+Var _NativeSet._storage has declared type change from _RawSetStorage to __RawSetStorage
+Var _RawDictionaryStorage.empty has declared type change from _EmptyDictionarySingleton to __EmptyDictionarySingleton
+Var _RawSetStorage.empty has declared type change from _EmptySetSingleton to __EmptySetSingleton
diff --git a/test/stdlib/Inputs/DictionaryKeyValueTypesObjC.swift b/test/stdlib/Inputs/DictionaryKeyValueTypesObjC.swift
index 35e87fd..d367e89 100644
--- a/test/stdlib/Inputs/DictionaryKeyValueTypesObjC.swift
+++ b/test/stdlib/Inputs/DictionaryKeyValueTypesObjC.swift
@@ -33,7 +33,7 @@
let className: NSString = NSStringFromClass(type(of: d)) as NSString
return [
"_SwiftDeferredNSDictionary",
- "_EmptyDictionarySingleton",
+ "__EmptyDictionarySingleton",
"_DictionaryStorage"].contains {
className.range(of: $0).length > 0
}
diff --git a/validation-test/stdlib/StringNormalization.swift b/validation-test/stdlib/StringNormalization.swift
index 488d8d5..c6c249c 100644
--- a/validation-test/stdlib/StringNormalization.swift
+++ b/validation-test/stdlib/StringNormalization.swift
@@ -22,6 +22,7 @@
// RUN: %target-run %t/a.out %S/Inputs/NormalizationTest.txt
// REQUIRES: executable_test
// REQUIRES: objc_interop
+// REQUIRES: optimized_stdlib
import Swift
import StdlibUnittest