Adds support for in-memory round-trip of sample profile data along with basic
round trip unit tests. This will also make it easier to include unit tests for
future changes to sample profiling.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
unittests/ProfileData/SampleProfTest.cpp | ||
---|---|---|
31 ↗ | (On Diff #41807) | Can you just hold this by value? |
Updated for davidxl and silvas comments.
include/llvm/ProfileData/SampleProfWriter.h | ||
---|---|---|
32 ↗ | (On Diff #41807) | Yes - we should be able to just use the stream interface. |
unittests/ProfileData/SampleProfTest.cpp | ||
31 ↗ | (On Diff #41807) | Yes...that implies that SampleProfileWriter::create() should take a raw_ostream & rather than unique_ptr<raw_ostream> in that case. And that means that a caller of SampleProfileWriter::create() owns the output stream rather than the writer. |
include/llvm/ProfileData/SampleProfWriter.h | ||
---|---|---|
61 ↗ | (On Diff #42230) | OK. Having a reference to the ostream (and caller owning it) would be slightly cleaner but precludes us having a factory method that takes a file name since somebody has to own the ostream. I'll put that back and switch back to unique_ptr<raw_ostream>. |
Updated for davidxl's comments.
Reverted to unique_ptr<raw_ostream> interface and put back SampleProfWriter file path factory function.