Correct the ownership model for sil-opt

Destroying the SIL remark streamer after transferring ownership to LLVM
is frought. For one, the streamer holds the remark file's stream open.
Destroying it early doesn't accomodate sil-opt, which transfers control
to LLVM before running passes that emit remarks.

Instead, just take a reference to the context that the streamer gets
parented onto. If the remarks streamer infrastructure could just hold
the file stream open for us, we wouldn't have to do any of this.
This commit is contained in:
Robert Widmann
2020-04-21 13:28:23 -07:00
parent 90d05c10fa
commit db845eb6b3
5 changed files with 29 additions and 7 deletions

View File

@@ -523,9 +523,7 @@ public:
swift::SILRemarkStreamer *getSILRemarkStreamer() {
return silRemarkStreamer.get();
}
std::unique_ptr<swift::SILRemarkStreamer> takeSILRemarkStreamer() {
return std::move(silRemarkStreamer);
}
void installSILRemarkStreamer();
// This is currently limited to VarDecl because the visibility of global