[PATCH] D153904: [instrprof] Add an overload to accept raw_string_ostream.
Snehasish Kumar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 27 13:39:01 PDT 2023
snehasish updated this revision to Diff 535120.
snehasish added a comment.
Fix capitalization in comment.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D153904/new/
https://reviews.llvm.org/D153904
Files:
llvm/include/llvm/ProfileData/InstrProfWriter.h
llvm/lib/ProfileData/InstrProfWriter.cpp
Index: llvm/lib/ProfileData/InstrProfWriter.cpp
===================================================================
--- llvm/lib/ProfileData/InstrProfWriter.cpp
+++ llvm/lib/ProfileData/InstrProfWriter.cpp
@@ -650,12 +650,16 @@
return writeImpl(POS);
}
+Error InstrProfWriter::write(raw_string_ostream &OS) {
+ ProfOStream POS(OS);
+ return writeImpl(POS);
+}
+
std::unique_ptr<MemoryBuffer> InstrProfWriter::writeBuffer() {
std::string Data;
raw_string_ostream OS(Data);
- ProfOStream POS(OS);
// Write the hash table.
- if (Error E = writeImpl(POS))
+ if (Error E = write(OS))
return nullptr;
// Return this in an aligned memory buffer.
return MemoryBuffer::getMemBufferCopy(Data);
Index: llvm/include/llvm/ProfileData/InstrProfWriter.h
===================================================================
--- llvm/include/llvm/ProfileData/InstrProfWriter.h
+++ llvm/include/llvm/ProfileData/InstrProfWriter.h
@@ -110,6 +110,9 @@
/// Write the profile to \c OS
Error write(raw_fd_ostream &OS);
+ /// Write the profile to a string output stream \c OS
+ Error write(raw_string_ostream &OS);
+
/// Write the profile in text format to \c OS
Error writeText(raw_fd_ostream &OS);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153904.535120.patch
Type: text/x-patch
Size: 1225 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230627/89e42b93/attachment.bin>
More information about the llvm-commits
mailing list