Skip to content

Commit fb8bfce

Browse files
authored
Merge pull request #32126 from jckarter/silvtable-nonoverridden-entries
Add a [nonoverridden] kind for SILVTable entries.
2 parents 67d8be7 + 564c1a5 commit fb8bfce

File tree

7 files changed

+15
-1
lines changed

7 files changed

+15
-1
lines changed

include/swift/SIL/SILVTable.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ class SILVTable : public llvm::ilist_node<SILVTable>,
5353
enum Kind : uint8_t {
5454
/// The vtable entry is for a method defined directly in this class.
5555
Normal,
56+
/// The vtable entry is for a method defined directly in this class, and is never overridden
57+
/// by subclasses.
58+
NormalNonOverridden,
5659
/// The vtable entry is inherited from the superclass.
5760
Inherited,
5861
/// The vtable entry is inherited from the superclass, and overridden

lib/SIL/IR/SILPrinter.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3127,6 +3127,9 @@ void SILVTable::print(llvm::raw_ostream &OS, bool Verbose) const {
31273127
switch (entry.TheKind) {
31283128
case SILVTable::Entry::Kind::Normal:
31293129
break;
3130+
case SILVTable::Entry::Kind::NormalNonOverridden:
3131+
OS << " [nonoverridden]";
3132+
break;
31303133
case SILVTable::Entry::Kind::Inherited:
31313134
OS << " [inherited]";
31323135
break;

lib/SIL/Parser/ParseSIL.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6090,6 +6090,9 @@ bool SILParserState::parseSILVTable(Parser &P) {
60906090
} else if (P.Tok.getText() == "inherited") {
60916091
P.consumeToken();
60926092
Kind = SILVTable::Entry::Kind::Inherited;
6093+
} else if (P.Tok.getText() == "nonoverridden") {
6094+
P.consumeToken();
6095+
Kind = SILVTable::Entry::Kind::NormalNonOverridden;
60936096
} else {
60946097
P.diagnose(P.Tok.getLoc(), diag::sil_vtable_bad_entry_kind);
60956098
return true;

lib/Serialization/DeserializeSIL.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ static Optional<SILVTable::Entry::Kind>
7979
fromStableVTableEntryKind(unsigned value) {
8080
switch (value) {
8181
case SIL_VTABLE_ENTRY_NORMAL: return SILVTable::Entry::Kind::Normal;
82+
case SIL_VTABLE_ENTRY_NORMAL_NON_OVERRIDDEN:
83+
return SILVTable::Entry::Kind::NormalNonOverridden;
8284
case SIL_VTABLE_ENTRY_INHERITED: return SILVTable::Entry::Kind::Inherited;
8385
case SIL_VTABLE_ENTRY_OVERRIDE: return SILVTable::Entry::Kind::Override;
8486
default: return None;

lib/Serialization/ModuleFormat.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const uint16_t SWIFTMODULE_VERSION_MAJOR = 0;
5555
/// describe what change you made. The content of this comment isn't important;
5656
/// it just ensures a conflict if two people change the module format.
5757
/// Don't worry about adhering to the 80-column limit for this line.
58-
const uint16_t SWIFTMODULE_VERSION_MINOR = 557; // COW instructions
58+
const uint16_t SWIFTMODULE_VERSION_MINOR = 558; // SILVTable entry kind for non-overridden entries
5959

6060
/// A standard hash seed used for all string hashes in a serialized module.
6161
///

lib/Serialization/SILFormat.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ using SILLinkageField = BCFixed<4>;
5151

5252
enum SILVTableEntryKindEncoding : uint8_t {
5353
SIL_VTABLE_ENTRY_NORMAL,
54+
SIL_VTABLE_ENTRY_NORMAL_NON_OVERRIDDEN,
5455
SIL_VTABLE_ENTRY_INHERITED,
5556
SIL_VTABLE_ENTRY_OVERRIDE,
5657
};

lib/Serialization/SerializeSIL.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ static unsigned toStableSILLinkage(SILLinkage linkage) {
7373
static unsigned toStableVTableEntryKind(SILVTable::Entry::Kind kind) {
7474
switch (kind) {
7575
case SILVTable::Entry::Kind::Normal: return SIL_VTABLE_ENTRY_NORMAL;
76+
case SILVTable::Entry::Kind::NormalNonOverridden:
77+
return SIL_VTABLE_ENTRY_NORMAL_NON_OVERRIDDEN;
7678
case SILVTable::Entry::Kind::Inherited: return SIL_VTABLE_ENTRY_INHERITED;
7779
case SILVTable::Entry::Kind::Override: return SIL_VTABLE_ENTRY_OVERRIDE;
7880
}

0 commit comments

Comments
 (0)