1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00

[XRay] Use std::errc::invalid_argument instead of std::errc::bad_message

This change should appease the mingw32 builds.

Similar to r293725.

Differential Revision: https://reviews.llvm.org/D53742

llvm-svn: 345416
This commit is contained in:
Yi Kong 2018-10-26 18:25:27 +00:00
parent acf8f9b68d
commit d460e7e9e1

View File

@ -20,7 +20,7 @@ Error RecordInitializer::visit(BufferExtents &R) {
auto PreReadOffset = OffsetPtr; auto PreReadOffset = OffsetPtr;
R.Size = E.getU64(&OffsetPtr); R.Size = E.getU64(&OffsetPtr);
if (PreReadOffset == OffsetPtr) if (PreReadOffset == OffsetPtr)
return createStringError(std::make_error_code(std::errc::bad_message), return createStringError(std::make_error_code(std::errc::invalid_argument),
"Cannot read buffer extent at offset %d.", "Cannot read buffer extent at offset %d.",
OffsetPtr); OffsetPtr);
@ -39,14 +39,14 @@ Error RecordInitializer::visit(WallclockRecord &R) {
R.Seconds = E.getU64(&OffsetPtr); R.Seconds = E.getU64(&OffsetPtr);
if (OffsetPtr == PreReadOffset) if (OffsetPtr == PreReadOffset)
return createStringError( return createStringError(
std::make_error_code(std::errc::bad_message), std::make_error_code(std::errc::invalid_argument),
"Cannot read wall clock 'seconds' field at offset %d.", OffsetPtr); "Cannot read wall clock 'seconds' field at offset %d.", OffsetPtr);
PreReadOffset = OffsetPtr; PreReadOffset = OffsetPtr;
R.Nanos = E.getU32(&OffsetPtr); R.Nanos = E.getU32(&OffsetPtr);
if (OffsetPtr == PreReadOffset) if (OffsetPtr == PreReadOffset)
return createStringError( return createStringError(
std::make_error_code(std::errc::bad_message), std::make_error_code(std::errc::invalid_argument),
"Cannot read wall clock 'nanos' field at offset %d.", OffsetPtr); "Cannot read wall clock 'nanos' field at offset %d.", OffsetPtr);
// Align to metadata record size boundary. // Align to metadata record size boundary.
@ -65,13 +65,13 @@ Error RecordInitializer::visit(NewCPUIDRecord &R) {
auto PreReadOffset = OffsetPtr; auto PreReadOffset = OffsetPtr;
R.CPUId = E.getU16(&OffsetPtr); R.CPUId = E.getU16(&OffsetPtr);
if (OffsetPtr == PreReadOffset) if (OffsetPtr == PreReadOffset)
return createStringError(std::make_error_code(std::errc::bad_message), return createStringError(std::make_error_code(std::errc::invalid_argument),
"Cannot read CPU id at offset %d.", OffsetPtr); "Cannot read CPU id at offset %d.", OffsetPtr);
PreReadOffset = OffsetPtr; PreReadOffset = OffsetPtr;
R.TSC = E.getU64(&OffsetPtr); R.TSC = E.getU64(&OffsetPtr);
if (OffsetPtr == PreReadOffset) if (OffsetPtr == PreReadOffset)
return createStringError(std::make_error_code(std::errc::bad_message), return createStringError(std::make_error_code(std::errc::invalid_argument),
"Cannot read CPU TSC at offset %d.", OffsetPtr); "Cannot read CPU TSC at offset %d.", OffsetPtr);
OffsetPtr += MetadataRecord::kMetadataBodySize - (OffsetPtr - BeginOffset); OffsetPtr += MetadataRecord::kMetadataBodySize - (OffsetPtr - BeginOffset);
@ -88,7 +88,7 @@ Error RecordInitializer::visit(TSCWrapRecord &R) {
auto PreReadOffset = OffsetPtr; auto PreReadOffset = OffsetPtr;
R.BaseTSC = E.getU64(&OffsetPtr); R.BaseTSC = E.getU64(&OffsetPtr);
if (PreReadOffset == OffsetPtr) if (PreReadOffset == OffsetPtr)
return createStringError(std::make_error_code(std::errc::bad_message), return createStringError(std::make_error_code(std::errc::invalid_argument),
"Cannot read TSC wrap record at offset %d.", "Cannot read TSC wrap record at offset %d.",
OffsetPtr); OffsetPtr);
@ -108,14 +108,14 @@ Error RecordInitializer::visit(CustomEventRecord &R) {
R.Size = E.getSigned(&OffsetPtr, sizeof(int32_t)); R.Size = E.getSigned(&OffsetPtr, sizeof(int32_t));
if (PreReadOffset == OffsetPtr) if (PreReadOffset == OffsetPtr)
return createStringError( return createStringError(
std::make_error_code(std::errc::bad_message), std::make_error_code(std::errc::invalid_argument),
"Cannot read a custom event record size field offset %d.", OffsetPtr); "Cannot read a custom event record size field offset %d.", OffsetPtr);
PreReadOffset = OffsetPtr; PreReadOffset = OffsetPtr;
R.TSC = E.getU64(&OffsetPtr); R.TSC = E.getU64(&OffsetPtr);
if (PreReadOffset == OffsetPtr) if (PreReadOffset == OffsetPtr)
return createStringError( return createStringError(
std::make_error_code(std::errc::bad_message), std::make_error_code(std::errc::invalid_argument),
"Cannot read a custom event TSC field at offset %d.", OffsetPtr); "Cannot read a custom event TSC field at offset %d.", OffsetPtr);
OffsetPtr += MetadataRecord::kMetadataBodySize - (OffsetPtr - BeginOffset); OffsetPtr += MetadataRecord::kMetadataBodySize - (OffsetPtr - BeginOffset);
@ -131,7 +131,7 @@ Error RecordInitializer::visit(CustomEventRecord &R) {
Buffer.resize(R.Size); Buffer.resize(R.Size);
if (E.getU8(&OffsetPtr, Buffer.data(), R.Size) != Buffer.data()) if (E.getU8(&OffsetPtr, Buffer.data(), R.Size) != Buffer.data())
return createStringError( return createStringError(
std::make_error_code(std::errc::bad_message), std::make_error_code(std::errc::invalid_argument),
"Failed reading data into buffer of size %d at offset %d.", R.Size, "Failed reading data into buffer of size %d at offset %d.", R.Size,
OffsetPtr); OffsetPtr);
R.Data.assign(Buffer.begin(), Buffer.end()); R.Data.assign(Buffer.begin(), Buffer.end());
@ -148,7 +148,7 @@ Error RecordInitializer::visit(CallArgRecord &R) {
auto PreReadOffset = OffsetPtr; auto PreReadOffset = OffsetPtr;
R.Arg = E.getU64(&OffsetPtr); R.Arg = E.getU64(&OffsetPtr);
if (PreReadOffset == OffsetPtr) if (PreReadOffset == OffsetPtr)
return createStringError(std::make_error_code(std::errc::bad_message), return createStringError(std::make_error_code(std::errc::invalid_argument),
"Cannot read a call arg record at offset %d.", "Cannot read a call arg record at offset %d.",
OffsetPtr); OffsetPtr);
@ -166,7 +166,7 @@ Error RecordInitializer::visit(PIDRecord &R) {
auto PreReadOffset = OffsetPtr; auto PreReadOffset = OffsetPtr;
R.PID = E.getSigned(&OffsetPtr, 4); R.PID = E.getSigned(&OffsetPtr, 4);
if (PreReadOffset == OffsetPtr) if (PreReadOffset == OffsetPtr)
return createStringError(std::make_error_code(std::errc::bad_message), return createStringError(std::make_error_code(std::errc::invalid_argument),
"Cannot read a process ID record at offset %d.", "Cannot read a process ID record at offset %d.",
OffsetPtr); OffsetPtr);
@ -184,7 +184,7 @@ Error RecordInitializer::visit(NewBufferRecord &R) {
auto PreReadOffset = OffsetPtr; auto PreReadOffset = OffsetPtr;
R.TID = E.getSigned(&OffsetPtr, sizeof(int32_t)); R.TID = E.getSigned(&OffsetPtr, sizeof(int32_t));
if (PreReadOffset == OffsetPtr) if (PreReadOffset == OffsetPtr)
return createStringError(std::make_error_code(std::errc::bad_message), return createStringError(std::make_error_code(std::errc::invalid_argument),
"Cannot read a new buffer record at offset %d.", "Cannot read a new buffer record at offset %d.",
OffsetPtr); OffsetPtr);
@ -234,7 +234,7 @@ Error RecordInitializer::visit(FunctionRecord &R) {
R.Kind = static_cast<RecordTypes>(FunctionType); R.Kind = static_cast<RecordTypes>(FunctionType);
break; break;
default: default:
return createStringError(std::make_error_code(std::errc::bad_message), return createStringError(std::make_error_code(std::errc::invalid_argument),
"Unknown function record type '%d' at offset %d.", "Unknown function record type '%d' at offset %d.",
FunctionType, BeginOffset); FunctionType, BeginOffset);
} }
@ -243,7 +243,7 @@ Error RecordInitializer::visit(FunctionRecord &R) {
PreReadOffset = OffsetPtr; PreReadOffset = OffsetPtr;
R.Delta = E.getU32(&OffsetPtr); R.Delta = E.getU32(&OffsetPtr);
if (OffsetPtr == PreReadOffset) if (OffsetPtr == PreReadOffset)
return createStringError(std::make_error_code(std::errc::bad_message), return createStringError(std::make_error_code(std::errc::invalid_argument),
"Failed reading TSC delta from offset %d.", "Failed reading TSC delta from offset %d.",
OffsetPtr); OffsetPtr);
assert(FunctionRecord::kFunctionRecordSize == (OffsetPtr - BeginOffset)); assert(FunctionRecord::kFunctionRecordSize == (OffsetPtr - BeginOffset));