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
Event Timeline
unittests/ProfileData/SampleProfTest.cpp | ||
---|---|---|
32 | Can you just hold this by value? |
Updated for davidxl and silvas comments.
include/llvm/ProfileData/SampleProfWriter.h | ||
---|---|---|
31–32 | Yes - we should be able to just use the stream interface. | |
unittests/ProfileData/SampleProfTest.cpp | ||
32 | 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 | 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.
///