[asan] Replace assignments with internal_memcpy ErrorDescription

For consistency with nearby code and to avoid interceptors during reports.

llvm-svn: 361304
This commit is contained in:
Vitaly Buka 2019-05-21 20:23:10 +00:00
parent a7e88f8570
commit e756730c23
2 changed files with 5 additions and 3 deletions

View File

@ -404,8 +404,10 @@ struct ErrorGeneric : ErrorBase {
#define ASAN_DEFINE_ERROR_KIND(name) kErrorKind##name,
#define ASAN_ERROR_DESCRIPTION_MEMBER(name) Error##name name;
#define ASAN_ERROR_DESCRIPTION_CONSTRUCTOR(name) \
ErrorDescription(Error##name const &e) : kind(kErrorKind##name), name(e) {}
#define ASAN_ERROR_DESCRIPTION_CONSTRUCTOR(name) \
ErrorDescription(Error##name const &e) : kind(kErrorKind##name) { \
internal_memcpy(&name, &e, sizeof(name)); \
}
#define ASAN_ERROR_DESCRIPTION_PRINT(name) \
case kErrorKind##name: \
return name.Print();

View File

@ -190,7 +190,7 @@ class ScopedInErrorReport {
void ReportError(const ErrorDescription &description) {
// Can only report one error per ScopedInErrorReport.
CHECK_EQ(current_error_.kind, kErrorKindInvalid);
current_error_ = description;
internal_memcpy(&current_error_, &description, sizeof(current_error_));
}
static ErrorDescription &CurrentError() {