diff --git a/include/swift/SIL/SILModule.h b/include/swift/SIL/SILModule.h index 2f81685e17a..bffe5c16c20 100644 --- a/include/swift/SIL/SILModule.h +++ b/include/swift/SIL/SILModule.h @@ -210,6 +210,9 @@ public: /// Erase a function from the module. void eraseFunction(SILFunction *F); + /// Erase a global SIL variable from the module. + void eraseGlobalVariable(SILGlobalVariable *G); + /// Construct a SIL module from an AST module. /// /// The module will be constructed in the Raw stage. The provided AST module diff --git a/lib/SIL/SILModule.cpp b/lib/SIL/SILModule.cpp index 0da39b1d004..f7aec1cbcdb 100644 --- a/lib/SIL/SILModule.cpp +++ b/lib/SIL/SILModule.cpp @@ -548,6 +548,12 @@ void SILModule::eraseFunction(SILFunction *F) { } } +/// Erase a global SIL variable from the module. +void SILModule::eraseGlobalVariable(SILGlobalVariable *G) { + GlobalVariableTable.erase(G->getName()); + getSILGlobalList().erase(G); +} + SILVTable *SILModule::lookUpVTable(const ClassDecl *C, std::function Callback) { if (!C)