mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Global Opt] add SILFunction *InitializerF to SILGlobalVariable.
It is defaulted to nullptr. When it is set, we increment the SILFunction's ref count to keep it alive. It will be used in followon patches for globals that can be statically initialized. Swift SVN r21983
This commit is contained in:
@@ -96,6 +96,11 @@ SILModule::SILModule(Module *SwiftModule, const DeclContext *associatedDC)
|
||||
}
|
||||
|
||||
SILModule::~SILModule() {
|
||||
// Decrement ref count for each SILGlobalVariable with static initializers.
|
||||
for (SILGlobalVariable &v : silGlobals)
|
||||
if (v.getInitializer())
|
||||
v.getInitializer()->decrementRefCount();
|
||||
|
||||
for (SILFunction *F : InlinedFunctions)
|
||||
F->decrementRefCount();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user