[PATCH] D43415: [ThinLTO] Always create linked objects file for --thinlto-index-only=

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 22 09:05:04 PST 2018


tejohnson accepted this revision.
tejohnson added a comment.
This revision is now accepted and ready to land.

LGTM



================
Comment at: llvm/lib/LTO/LTO.cpp:1037
   bool ShouldEmitImportsFiles;
-
-  std::string LinkedObjectsFileName;
-  std::unique_ptr<llvm::raw_fd_ostream> LinkedObjectsFile;
-
+  std::shared_ptr<raw_fd_ostream> LinkedObjectsFile;
   lto::IndexWriteCallback OnWrite;
----------------
vitalybuka wrote:
> tejohnson wrote:
> > We only have one backend object - why use a shared_ptr instead of a unique_ptr?
> No easy way to capture unique_ptr and copy that into std::function in c++11.
> I can avoid transferring stream ownership. But to my taste shared_ptr version was better.
I see, thanks for the explanation. I think I prefer then keeping the ownership in the client as you have done here.


================
Comment at: llvm/tools/gold/gold-plugin.cpp:740
+/// Creates instance of LTO.
+/// OnWrite is callback to let caller know when LTO writes index files.
+/// LinkedObjectsFile is an output stream to write the list of object files for
----------------
s/OnWrite/OnIndexWrite/


https://reviews.llvm.org/D43415





More information about the llvm-commits mailing list