[PATCH] D43537: [gold] Extract runLTO to avoid exit(0) from function with non-trivial objects on the stack

Vitaly Buka via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 21 11:43:47 PST 2018


vitalybuka added a comment.

In https://reviews.llvm.org/D43537#1014745, @tejohnson wrote:

> Can you clarify the motivation for this change - I don't see what is significantly different.  The exit(0) for the index-only case is still in the same location and we just end up with a different data structure (Files) on the stack. AFAICT this just trades 2 vectors for a vector of tuples.


exit(0) skips destructors, but we had LTO and dependencies objects on the stack. Some of them may have or add in the future non trivial destructors. E.g. closing files.
In https://reviews.llvm.org/D43415 I've added local std::unique_ptr<raw_fd_ostream> and it produced  empty outputs, because stream was not closed correctly by destructor.


https://reviews.llvm.org/D43537





More information about the llvm-commits mailing list