/// Return a pointer to \c ValueProfData instance ready to be streamed.
static std::unique_ptr<ValueProfData>
serializeFrom(const InstrProfRecord &Record);
+ /// Check the integrity of the record. Return the error code when
+ /// an error is detected, otherwise return instrprof_error::success.
+ instrprof_error checkIntegrity();
/// Return a pointer to \c ValueProfileData instance ready to be read.
/// All data in the instance are properly byte swapped. The input
/// data is assumed to be in little endian order.
static ErrorOr<std::unique_ptr<ValueProfData>>
- getValueProfData(const unsigned char *D, const unsigned char *const BufferEnd,
+ getValueProfData(const unsigned char *SrcBuffer,
+ const unsigned char *const SrcBufferEnd,
support::endianness SrcDataEndianness);
/// Swap byte order from \c Endianness order to host byte order.
void swapBytesToHost(support::endianness Endianness);
/* Return a ValueProfData instance that stores the data collected at runtime. */
ValueProfData *
-serializeValueProfDataFromRT(const ValueProfRuntimeRecord *Record);
-
+serializeValueProfDataFromRT(const ValueProfRuntimeRecord *Record,
+ ValueProfData *Dst);
/*! \brief Return the \c ValueProfRecord header size including the
* padding bytes.