Skip to content

Commit a49e2dd

Browse files
committed
[Stdlib] Rename AnyKeyPath's ObjC name and _VaListBuilder to avoid conflicts with older stdlibs.
rdar://problem/46546165
1 parent 9cf75f3 commit a49e2dd

File tree

4 files changed

+61
-46
lines changed

4 files changed

+61
-46
lines changed

stdlib/public/core/KeyPath.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ internal func _abstract(
2626

2727
// MARK: Type-erased abstract base classes
2828

29-
/// A type-erased key path, from any root type to any resulting value type.
29+
/// A type-erased key path, from any root type to any resulting value
30+
/// type. NOTE: older runtimes had Swift.AnyKeyPath as the ObjC name.
31+
/// The two must coexist, so it was renamed. The old name must not be
32+
/// used in the new runtime.
33+
@objc(_SwiftAnyKeyPath)
3034
public class AnyKeyPath: Hashable, _AppendKeyPath {
3135
/// The root type for this key path.
3236
@inlinable

stdlib/public/core/VarArgs.swift

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ internal typealias _VAInt = Int32
144144
@inlinable // c-abi
145145
public func withVaList<R>(_ args: [CVarArg],
146146
_ body: (CVaListPointer) -> R) -> R {
147-
let builder = _VaListBuilder()
147+
let builder = __VaListBuilder()
148148
for a in args {
149149
builder.append(a)
150150
}
@@ -154,7 +154,7 @@ public func withVaList<R>(_ args: [CVarArg],
154154
/// Invoke `body` with a C `va_list` argument derived from `builder`.
155155
@inlinable // c-abi
156156
internal func _withVaList<R>(
157-
_ builder: _VaListBuilder,
157+
_ builder: __VaListBuilder,
158158
_ body: (CVaListPointer) -> R
159159
) -> R {
160160
let result = body(builder.va_list())
@@ -185,7 +185,7 @@ internal func _withVaList<R>(
185185
/// `va_list` argument.
186186
@inlinable // c-abi
187187
public func getVaList(_ args: [CVarArg]) -> CVaListPointer {
188-
let builder = _VaListBuilder()
188+
let builder = __VaListBuilder()
189189
for a in args {
190190
builder.append(a)
191191
}
@@ -423,9 +423,12 @@ extension Float80 : CVarArg, _CVarArgAligned {
423423

424424
/// An object that can manage the lifetime of storage backing a
425425
/// `CVaListPointer`.
426+
// NOTE: older runtimes called this _VaListBuilder. The two must
427+
// coexist, so it was renamed. The old name must not be used in the new
428+
// runtime.
426429
@_fixed_layout
427430
@usableFromInline // c-abi
428-
final internal class _VaListBuilder {
431+
final internal class __VaListBuilder {
429432
@_fixed_layout // c-abi
430433
@usableFromInline
431434
internal struct Header {
@@ -517,9 +520,12 @@ final internal class _VaListBuilder {
517520
}
518521
#elseif arch(arm64) && os(Linux)
519522

523+
// NOTE: older runtimes called this _VaListBuilder. The two must
524+
// coexist, so it was renamed. The old name must not be used in the new
525+
// runtime.
520526
@_fixed_layout // FIXME(sil-serialize-all)
521527
@usableFromInline // FIXME(sil-serialize-all)
522-
final internal class _VaListBuilder {
528+
final internal class __VaListBuilder {
523529
@usableFromInline // FIXME(sil-serialize-all)
524530
internal init() {
525531
// Prepare the register save area.
@@ -643,9 +649,12 @@ final internal class _VaListBuilder {
643649

644650
/// An object that can manage the lifetime of storage backing a
645651
/// `CVaListPointer`.
652+
// NOTE: older runtimes called this _VaListBuilder. The two must
653+
// coexist, so it was renamed. The old name must not be used in the new
654+
// runtime.
646655
@_fixed_layout
647656
@usableFromInline // c-abi
648-
final internal class _VaListBuilder {
657+
final internal class __VaListBuilder {
649658

650659
@inlinable // c-abi
651660
internal init() {}
@@ -673,16 +682,16 @@ final internal class _VaListBuilder {
673682
}
674683

675684
// NB: This function *cannot* be @inlinable because it expects to project
676-
// and escape the physical storage of `_VaListBuilder.alignedStorageForEmptyVaLists`.
685+
// and escape the physical storage of `__VaListBuilder.alignedStorageForEmptyVaLists`.
677686
// Marking it inlinable will cause it to resiliently use accessors to
678-
// project `_VaListBuilder.alignedStorageForEmptyVaLists` as a computed
687+
// project `__VaListBuilder.alignedStorageForEmptyVaLists` as a computed
679688
// property.
680689
@usableFromInline // c-abi
681690
internal func va_list() -> CVaListPointer {
682691
// Use Builtin.addressof to emphasize that we are deliberately escaping this
683692
// pointer and assuming it is safe to do so.
684693
let emptyAddr = UnsafeMutablePointer<Int>(
685-
Builtin.addressof(&_VaListBuilder.alignedStorageForEmptyVaLists))
694+
Builtin.addressof(&__VaListBuilder.alignedStorageForEmptyVaLists))
686695
return CVaListPointer(_fromUnsafeMutablePointer: storage ?? emptyAddr)
687696
}
688697

test/api-digester/Inputs/stdlib-stable-abi.json

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -254167,9 +254167,9 @@
254167254167
},
254168254168
{
254169254169
"kind": "TypeNominal",
254170-
"name": "_VaListBuilder",
254171-
"printedName": "_VaListBuilder",
254172-
"usr": "s:s14_VaListBuilderC"
254170+
"name": "__VaListBuilder",
254171+
"printedName": "__VaListBuilder",
254172+
"usr": "s:s15__VaListBuilderC"
254173254173
},
254174254174
{
254175254175
"kind": "TypeFunc",
@@ -254272,8 +254272,8 @@
254272254272
},
254273254273
{
254274254274
"kind": "TypeDecl",
254275-
"name": "_VaListBuilder",
254276-
"printedName": "_VaListBuilder",
254275+
"name": "__VaListBuilder",
254276+
"printedName": "__VaListBuilder",
254277254277
"children": [
254278254278
{
254279254279
"kind": "TypeDecl",
@@ -254288,12 +254288,12 @@
254288254288
{
254289254289
"kind": "TypeNominal",
254290254290
"name": "Header",
254291-
"printedName": "_VaListBuilder.Header",
254292-
"usr": "s:s14_VaListBuilderC6HeaderV"
254291+
"printedName": "__VaListBuilder.Header",
254292+
"usr": "s:s15__VaListBuilderC6HeaderV"
254293254293
}
254294254294
],
254295254295
"declKind": "Constructor",
254296-
"usr": "s:s14_VaListBuilderC6HeaderVADycfc",
254296+
"usr": "s:s15__VaListBuilderC6HeaderVADycfc",
254297254297
"moduleName": "Swift",
254298254298
"declAttributes": [
254299254299
"Inlinable"
@@ -254323,7 +254323,7 @@
254323254323
}
254324254324
],
254325254325
"declKind": "Accessor",
254326-
"usr": "s:s14_VaListBuilderC6HeaderV9gp_offsets6UInt32Vvg",
254326+
"usr": "s:s15__VaListBuilderC6HeaderV9gp_offsets6UInt32Vvg",
254327254327
"moduleName": "Swift",
254328254328
"implicit": true,
254329254329
"declAttributes": [
@@ -254332,7 +254332,7 @@
254332254332
}
254333254333
],
254334254334
"declKind": "Var",
254335-
"usr": "s:s14_VaListBuilderC6HeaderV9gp_offsets6UInt32Vvp",
254335+
"usr": "s:s15__VaListBuilderC6HeaderV9gp_offsets6UInt32Vvp",
254336254336
"moduleName": "Swift",
254337254337
"declAttributes": [
254338254338
"HasInitialValue",
@@ -254365,7 +254365,7 @@
254365254365
}
254366254366
],
254367254367
"declKind": "Accessor",
254368-
"usr": "s:s14_VaListBuilderC6HeaderV9fp_offsets6UInt32Vvg",
254368+
"usr": "s:s15__VaListBuilderC6HeaderV9fp_offsets6UInt32Vvg",
254369254369
"moduleName": "Swift",
254370254370
"implicit": true,
254371254371
"declAttributes": [
@@ -254374,7 +254374,7 @@
254374254374
}
254375254375
],
254376254376
"declKind": "Var",
254377-
"usr": "s:s14_VaListBuilderC6HeaderV9fp_offsets6UInt32Vvp",
254377+
"usr": "s:s15__VaListBuilderC6HeaderV9fp_offsets6UInt32Vvp",
254378254378
"moduleName": "Swift",
254379254379
"declAttributes": [
254380254380
"HasInitialValue",
@@ -254439,7 +254439,7 @@
254439254439
}
254440254440
],
254441254441
"declKind": "Accessor",
254442-
"usr": "s:s14_VaListBuilderC6HeaderV17overflow_arg_areaSpySiGSgvg",
254442+
"usr": "s:s15__VaListBuilderC6HeaderV17overflow_arg_areaSpySiGSgvg",
254443254443
"moduleName": "Swift",
254444254444
"implicit": true,
254445254445
"declAttributes": [
@@ -254448,7 +254448,7 @@
254448254448
}
254449254449
],
254450254450
"declKind": "Var",
254451-
"usr": "s:s14_VaListBuilderC6HeaderV17overflow_arg_areaSpySiGSgvp",
254451+
"usr": "s:s15__VaListBuilderC6HeaderV17overflow_arg_areaSpySiGSgvp",
254452254452
"moduleName": "Swift",
254453254453
"declAttributes": [
254454254454
"HasInitialValue",
@@ -254513,7 +254513,7 @@
254513254513
}
254514254514
],
254515254515
"declKind": "Accessor",
254516-
"usr": "s:s14_VaListBuilderC6HeaderV13reg_save_areaSpySiGSgvg",
254516+
"usr": "s:s15__VaListBuilderC6HeaderV13reg_save_areaSpySiGSgvg",
254517254517
"moduleName": "Swift",
254518254518
"implicit": true,
254519254519
"declAttributes": [
@@ -254522,7 +254522,7 @@
254522254522
}
254523254523
],
254524254524
"declKind": "Var",
254525-
"usr": "s:s14_VaListBuilderC6HeaderV13reg_save_areaSpySiGSgvp",
254525+
"usr": "s:s15__VaListBuilderC6HeaderV13reg_save_areaSpySiGSgvp",
254526254526
"moduleName": "Swift",
254527254527
"declAttributes": [
254528254528
"HasInitialValue",
@@ -254533,7 +254533,7 @@
254533254533
}
254534254534
],
254535254535
"declKind": "Struct",
254536-
"usr": "s:s14_VaListBuilderC6HeaderV",
254536+
"usr": "s:s15__VaListBuilderC6HeaderV",
254537254537
"moduleName": "Swift",
254538254538
"declAttributes": [
254539254539
"UsableFromInline",
@@ -254564,7 +254564,7 @@
254564254564
}
254565254565
],
254566254566
"declKind": "Accessor",
254567-
"usr": "s:s14_VaListBuilderC15gpRegistersUsedSivg",
254567+
"usr": "s:s15__VaListBuilderC15gpRegistersUsedSivg",
254568254568
"moduleName": "Swift",
254569254569
"implicit": true,
254570254570
"declAttributes": [
@@ -254574,7 +254574,7 @@
254574254574
}
254575254575
],
254576254576
"declKind": "Var",
254577-
"usr": "s:s14_VaListBuilderC15gpRegistersUsedSivp",
254577+
"usr": "s:s15__VaListBuilderC15gpRegistersUsedSivp",
254578254578
"moduleName": "Swift",
254579254579
"declAttributes": [
254580254580
"Final",
@@ -254608,7 +254608,7 @@
254608254608
}
254609254609
],
254610254610
"declKind": "Accessor",
254611-
"usr": "s:s14_VaListBuilderC15fpRegistersUsedSivg",
254611+
"usr": "s:s15__VaListBuilderC15fpRegistersUsedSivg",
254612254612
"moduleName": "Swift",
254613254613
"implicit": true,
254614254614
"declAttributes": [
@@ -254618,7 +254618,7 @@
254618254618
}
254619254619
],
254620254620
"declKind": "Var",
254621-
"usr": "s:s14_VaListBuilderC15fpRegistersUsedSivp",
254621+
"usr": "s:s15__VaListBuilderC15fpRegistersUsedSivp",
254622254622
"moduleName": "Swift",
254623254623
"declAttributes": [
254624254624
"Final",
@@ -254636,8 +254636,8 @@
254636254636
{
254637254637
"kind": "TypeNominal",
254638254638
"name": "Header",
254639-
"printedName": "_VaListBuilder.Header",
254640-
"usr": "s:s14_VaListBuilderC6HeaderV"
254639+
"printedName": "__VaListBuilder.Header",
254640+
"usr": "s:s15__VaListBuilderC6HeaderV"
254641254641
},
254642254642
{
254643254643
"kind": "Getter",
@@ -254647,12 +254647,12 @@
254647254647
{
254648254648
"kind": "TypeNominal",
254649254649
"name": "Header",
254650-
"printedName": "_VaListBuilder.Header",
254651-
"usr": "s:s14_VaListBuilderC6HeaderV"
254650+
"printedName": "__VaListBuilder.Header",
254651+
"usr": "s:s15__VaListBuilderC6HeaderV"
254652254652
}
254653254653
],
254654254654
"declKind": "Accessor",
254655-
"usr": "s:s14_VaListBuilderC6headerAB6HeaderVvg",
254655+
"usr": "s:s15__VaListBuilderC6headerAB6HeaderVvg",
254656254656
"moduleName": "Swift",
254657254657
"implicit": true,
254658254658
"declAttributes": [
@@ -254662,7 +254662,7 @@
254662254662
}
254663254663
],
254664254664
"declKind": "Var",
254665-
"usr": "s:s14_VaListBuilderC6headerAB6HeaderVvp",
254665+
"usr": "s:s15__VaListBuilderC6headerAB6HeaderVvp",
254666254666
"moduleName": "Swift",
254667254667
"declAttributes": [
254668254668
"HasInitialValue",
@@ -254712,7 +254712,7 @@
254712254712
}
254713254713
],
254714254714
"declKind": "Accessor",
254715-
"usr": "s:s14_VaListBuilderC7storages15ContiguousArrayVySiGvg",
254715+
"usr": "s:s15__VaListBuilderC7storages15ContiguousArrayVySiGvg",
254716254716
"moduleName": "Swift",
254717254717
"implicit": true,
254718254718
"declAttributes": [
@@ -254722,7 +254722,7 @@
254722254722
}
254723254723
],
254724254724
"declKind": "Var",
254725-
"usr": "s:s14_VaListBuilderC7storages15ContiguousArrayVySiGvp",
254725+
"usr": "s:s15__VaListBuilderC7storages15ContiguousArrayVySiGvp",
254726254726
"moduleName": "Swift",
254727254727
"declAttributes": [
254728254728
"Final",
@@ -254738,13 +254738,13 @@
254738254738
"children": [
254739254739
{
254740254740
"kind": "TypeNominal",
254741-
"name": "_VaListBuilder",
254742-
"printedName": "_VaListBuilder",
254743-
"usr": "s:s14_VaListBuilderC"
254741+
"name": "__VaListBuilder",
254742+
"printedName": "__VaListBuilder",
254743+
"usr": "s:s15__VaListBuilderC"
254744254744
}
254745254745
],
254746254746
"declKind": "Constructor",
254747-
"usr": "s:s14_VaListBuilderCABycfc",
254747+
"usr": "s:s15__VaListBuilderCABycfc",
254748254748
"moduleName": "Swift",
254749254749
"declAttributes": [
254750254750
"Inlinable"
@@ -254768,7 +254768,7 @@
254768254768
}
254769254769
],
254770254770
"declKind": "Func",
254771-
"usr": "s:s14_VaListBuilderC6appendyys7CVarArg_pF",
254771+
"usr": "s:s15__VaListBuilderC6appendyys7CVarArg_pF",
254772254772
"moduleName": "Swift",
254773254773
"declAttributes": [
254774254774
"Final",
@@ -254789,7 +254789,7 @@
254789254789
}
254790254790
],
254791254791
"declKind": "Func",
254792-
"usr": "s:s14_VaListBuilderC7va_lists03CVaB7PointerVyF",
254792+
"usr": "s:s15__VaListBuilderC7va_lists03CVaB7PointerVyF",
254793254793
"moduleName": "Swift",
254794254794
"declAttributes": [
254795254795
"Final",
@@ -254799,7 +254799,7 @@
254799254799
}
254800254800
],
254801254801
"declKind": "Class",
254802-
"usr": "s:s14_VaListBuilderC",
254802+
"usr": "s:s15__VaListBuilderC",
254803254803
"moduleName": "Swift",
254804254804
"declAttributes": [
254805254805
"Final",

test/api-digester/Outputs/stability-stdlib-abi.swift.expected

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,3 +604,5 @@ Var String.Index._utf16Index has been removed (deprecated)
604604

605605
Func MutableCollection.withContiguousMutableStorageIfAvailable(_:) has been added as a protocol requirement
606606
Func Sequence.withContiguousStorageIfAvailable(_:) has been added as a protocol requirement
607+
608+
Class AnyKeyPath is now with @objc

0 commit comments

Comments
 (0)