28 auto PreReadOffset = OffsetPtr;
30 if (OffsetPtr == PreReadOffset)
32 std::make_error_code(std::errc::invalid_argument),
33 "Failed reading version from file header at offset %" PRId64
".",
36 PreReadOffset = OffsetPtr;
37 FileHeader.
Type = HeaderExtractor.
getU16(&OffsetPtr);
38 if (OffsetPtr == PreReadOffset)
40 std::make_error_code(std::errc::invalid_argument),
41 "Failed reading file type from file header at offset %" PRId64
".",
44 PreReadOffset = OffsetPtr;
46 if (OffsetPtr == PreReadOffset)
48 std::make_error_code(std::errc::invalid_argument),
49 "Failed reading flag bits from file header at offset %" PRId64
".",
54 PreReadOffset = OffsetPtr;
56 if (OffsetPtr == PreReadOffset)
58 std::make_error_code(std::errc::invalid_argument),
59 "Failed reading cycle frequency from file header at offset %" PRId64
69 return std::move(FileHeader);
Tagged union holding either a T or a Error.
const unsigned char * bytes_begin() const
Expected< XRayFileHeader > readBinaryFormatHeader(DataExtractor &HeaderExtractor, uint64_t &OffsetPtr)
Convenience function for loading the file header given a data extractor at a specified offset.
This is an optimization pass for GlobalISel generic memory operations.
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
Holds functions to get, set or test bitfields.