mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
SIL: Only enable instruction leaks checking in the frontend's and SILOpt's modules.
Leaks checking is not thread safe and e.g. lldb creates multiple SILModules in multiple threads, which would result in false alarms. Ideally we would make it thread safe, e.g. by putting the instruction counters in the SILModule, but this would be a big effort and it's not worth doing it. Leaks checking in the frontend's and SILOpt's SILModule (not including SILModules created for module interface building) is a good enough test. rdar://84688015
This commit is contained in:
@@ -151,6 +151,13 @@ SILModule::~SILModule() {
|
||||
}
|
||||
|
||||
void SILModule::checkForLeaks() const {
|
||||
|
||||
/// Leak checking is not thread safe, because the instruction counters are
|
||||
/// global non-atomic variables. Leak checking can only be done in case there
|
||||
/// is a single SILModule in a single thread.
|
||||
if (!getOptions().checkSILModuleLeaks)
|
||||
return;
|
||||
|
||||
int instsInModule = std::distance(scheduledForDeletion.begin(),
|
||||
scheduledForDeletion.end());
|
||||
for (const SILFunction &F : *this) {
|
||||
|
||||
Reference in New Issue
Block a user