mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[move-only] Add the ability to specify a deinit at the SIL level for a move only type.
Specifically, we get an additional table like thing called sil_moveonlydeinit. It looks as follows:
sil_moveonlydeinit TYPE {
@FUNC_NAME
}
It always has a single entry.
This commit is contained in:
@@ -11,12 +11,15 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#define DEBUG_TYPE "serialized-sil-loader"
|
||||
#include "swift/Serialization/SerializedSILLoader.h"
|
||||
|
||||
#include "DeserializeSIL.h"
|
||||
#include "ModuleFile.h"
|
||||
#include "swift/Serialization/SerializedModuleLoader.h"
|
||||
#include "swift/SIL/SILModule.h"
|
||||
|
||||
#include "swift/AST/ASTMangler.h"
|
||||
#include "swift/SIL/SILModule.h"
|
||||
#include "swift/SIL/SILMoveOnlyDeinit.h"
|
||||
#include "swift/Serialization/SerializedModuleLoader.h"
|
||||
#include "swift/Serialization/SerializedSILLoader.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
|
||||
using namespace swift;
|
||||
@@ -108,6 +111,18 @@ SILVTable *SerializedSILLoader::lookupVTable(const ClassDecl *C) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SILMoveOnlyDeinit *
|
||||
SerializedSILLoader::lookupMoveOnlyDeinit(const NominalTypeDecl *nomDecl) {
|
||||
Mangle::ASTMangler mangler;
|
||||
std::string mangledClassName = mangler.mangleNominalType(nomDecl);
|
||||
|
||||
for (auto &des : LoadedSILSections) {
|
||||
if (auto *tbl = des->lookupMoveOnlyDeinit(mangledClassName))
|
||||
return tbl;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SILWitnessTable *SerializedSILLoader::lookupWitnessTable(SILWitnessTable *WT) {
|
||||
for (auto &Des : LoadedSILSections)
|
||||
if (auto wT = Des->lookupWitnessTable(WT))
|
||||
|
||||
Reference in New Issue
Block a user