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:
Erik Eckstein
2021-10-29 21:05:22 +02:00
parent 2ad0eb7717
commit 5321a7cae8
8 changed files with 38 additions and 3 deletions

View File

@@ -2065,6 +2065,10 @@ int swift::performFrontend(ArrayRef<const char *> Args,
FrontendOptions::ActionType::Immediate) {
llvm::setBugReportMsg(nullptr);
}
/// Enable leaks checking because this SILModule is the only one in the process
/// (leaks checking is not thread safe).
Invocation.getSILOptions().checkSILModuleLeaks = true;
PrettyStackTraceFrontend frontendTrace(Invocation.getLangOptions());