summaryrefslogtreecommitdiff
path: root/lib/profile/InstrProfilingBuffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/profile/InstrProfilingBuffer.c')
-rw-r--r--lib/profile/InstrProfilingBuffer.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/lib/profile/InstrProfilingBuffer.c b/lib/profile/InstrProfilingBuffer.c
index ac259e83c..a7e852f53 100644
--- a/lib/profile/InstrProfilingBuffer.c
+++ b/lib/profile/InstrProfilingBuffer.c
@@ -45,15 +45,24 @@ uint64_t __llvm_profile_get_size_for_buffer_internal(
(CountersEnd - CountersBegin) * sizeof(uint64_t) + NamesSize + Padding;
}
+COMPILER_RT_VISIBILITY
+void initBufferWriter(ProfDataWriter *BufferWriter, char *Buffer) {
+ BufferWriter->Write = lprofBufferWriter;
+ BufferWriter->WriterCtx = Buffer;
+}
+
COMPILER_RT_VISIBILITY int __llvm_profile_write_buffer(char *Buffer) {
- return lprofWriteData(lprofBufferWriter, Buffer, 0);
+ ProfDataWriter BufferWriter;
+ initBufferWriter(&BufferWriter, Buffer);
+ return lprofWriteData(&BufferWriter, 0, 0);
}
COMPILER_RT_VISIBILITY int __llvm_profile_write_buffer_internal(
char *Buffer, const __llvm_profile_data *DataBegin,
const __llvm_profile_data *DataEnd, const uint64_t *CountersBegin,
const uint64_t *CountersEnd, const char *NamesBegin, const char *NamesEnd) {
- return lprofWriteDataImpl(lprofBufferWriter, Buffer, DataBegin, DataEnd,
- CountersBegin, CountersEnd, 0, NamesBegin,
- NamesEnd);
+ ProfDataWriter BufferWriter;
+ initBufferWriter(&BufferWriter, Buffer);
+ return lprofWriteDataImpl(&BufferWriter, DataBegin, DataEnd, CountersBegin,
+ CountersEnd, 0, NamesBegin, NamesEnd, 0);
}