mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[SIL] NFC: Make SILVTable follow C++ and LLVM best practices
1) Convert the `Entry` type to a class with getters/setters 2) Use llvm::TrailingObjects 3) Use llvm::PointerIntPair
This commit is contained in:
@@ -29,31 +29,31 @@ class PruneVTables : public SILModuleTransform {
|
||||
for (auto &entry : vtable->getMutableEntries()) {
|
||||
// We don't need to worry about entries that are inherited, overridden,
|
||||
// or have already been found to have no overrides.
|
||||
if (entry.TheKind != SILVTable::Entry::Normal) {
|
||||
if (entry.getKind() != SILVTable::Entry::Normal) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// The destructor entry must remain.
|
||||
if (entry.Method.kind == SILDeclRef::Kind::Deallocator) {
|
||||
if (entry.getMethod().kind == SILDeclRef::Kind::Deallocator) {
|
||||
continue;
|
||||
}
|
||||
|
||||
auto methodDecl = entry.Method.getAbstractFunctionDecl();
|
||||
|
||||
auto methodDecl = entry.getMethod().getAbstractFunctionDecl();
|
||||
if (!methodDecl)
|
||||
continue;
|
||||
|
||||
// Is the method declared final?
|
||||
if (!methodDecl->isFinal()) {
|
||||
// Are callees of this entry statically knowable?
|
||||
if (!calleesAreStaticallyKnowable(*M, entry.Method))
|
||||
if (!calleesAreStaticallyKnowable(*M, entry.getMethod()))
|
||||
continue;
|
||||
|
||||
// Does the method have any overrides in this module?
|
||||
if (methodDecl->isOverridden())
|
||||
continue;
|
||||
}
|
||||
|
||||
entry.TheKind = SILVTable::Entry::NormalNonOverridden;
|
||||
|
||||
entry.setKind(SILVTable::Entry::NormalNonOverridden);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user