Skip to content

Commit 124808d

Browse files
authored
Merge pull request swiftlang#32088 from jckarter/final-keypath-methods
Make an internal KeyPath helper final.
2 parents 5204af3 + 2433646 commit 124808d

File tree

4 files changed

+14
-11
lines changed

4 files changed

+14
-11
lines changed

include/swift/AST/Attr.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ DECL_ATTR(available, Available,
126126
CONTEXTUAL_SIMPLE_DECL_ATTR(final, Final,
127127
OnClass | OnFunc | OnAccessor | OnVar | OnSubscript |
128128
DeclModifier |
129-
ABIBreakingToAdd | ABIBreakingToRemove | APIBreakingToAdd | APIStableToRemove,
129+
ABIBreakingToAdd | ABIBreakingToRemove | APIStableToAdd | APIStableToRemove,
130130
2)
131131
DECL_ATTR(objc, ObjC,
132132
OnAbstractFunction | OnClass | OnProtocol | OnExtension | OnVar |

lib/IRGen/GenMeta.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
//
1515
//===----------------------------------------------------------------------===//
1616

17+
#define DEBUG_TYPE "type-metadata-layout"
18+
1719
#include "swift/ABI/MetadataValues.h"
1820
#include "swift/ABI/TypeIdentity.h"
1921
#include "swift/AST/ASTContext.h"
@@ -1521,6 +1523,15 @@ namespace {
15211523
void addVTable() {
15221524
if (VTableEntries.empty())
15231525
return;
1526+
1527+
LLVM_DEBUG(
1528+
llvm::dbgs() << "VTable entries for " << getType()->getName() << ":\n";
1529+
for (auto entry : VTableEntries) {
1530+
llvm::dbgs() << " ";
1531+
entry.print(llvm::dbgs());
1532+
llvm::dbgs() << '\n';
1533+
}
1534+
);
15241535

15251536
// Only emit a method lookup function if the class is resilient
15261537
// and has a non-empty vtable.

stdlib/public/core/KeyPath.swift

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ public class AnyKeyPath: Hashable, _AppendKeyPath {
134134

135135
// Prevent normal initialization. We use tail allocation via
136136
// allocWithTailElems().
137+
@available(*, unavailable)
137138
internal init() {
138139
_internalInvariantFailure("use _create(...)")
139140
}
@@ -158,7 +159,7 @@ public class AnyKeyPath: Hashable, _AppendKeyPath {
158159
return result
159160
}
160161

161-
internal func withBuffer<T>(_ f: (KeyPathBuffer) throws -> T) rethrows -> T {
162+
final internal func withBuffer<T>(_ f: (KeyPathBuffer) throws -> T) rethrows -> T {
162163
defer { _fixLifetime(self) }
163164

164165
let base = UnsafeRawPointer(Builtin.projectTailElems(self, Int32.self))
@@ -348,14 +349,6 @@ public class ReferenceWritableKeyPath<
348349

349350
internal final override class var kind: Kind { return .reference }
350351

351-
internal final override func _projectMutableAddress(
352-
from base: UnsafePointer<Root>
353-
) -> (pointer: UnsafeMutablePointer<Value>, owner: AnyObject?) {
354-
// Since we're a ReferenceWritableKeyPath, we know we don't mutate the base
355-
// in practice.
356-
return _projectMutableAddress(from: base.pointee)
357-
}
358-
359352
@usableFromInline
360353
internal final func _projectMutableAddress(from origBase: Root)
361354
-> (pointer: UnsafeMutablePointer<Value>, owner: AnyObject?) {

test/api-digester/Outputs/Cake.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ cake: TypeAlias TChangesFromIntToString.T has underlying type change from Swift.
4040
/* Decl Attribute changes */
4141
cake: Enum IceKind is now without @frozen
4242
cake: Func C1.foo1() is now not static
43-
cake: Func FinalFuncContainer.NewFinalFunc() is now with final
4443
cake: Func HasMutatingMethodClone.foo() has self access kind changing from Mutating to NonMutating
4544
cake: Func S1.foo1() has self access kind changing from NonMutating to Mutating
4645
cake: Func S1.foo3() is now static

0 commit comments

Comments
 (0)