diff options
| author | Vitaly Buka <vitalybuka@google.com> | 2019-05-21 20:23:10 +0000 |
|---|---|---|
| committer | Vitaly Buka <vitalybuka@google.com> | 2019-05-21 20:23:10 +0000 |
| commit | e756730c23ef490abd4441acc40a70024bbfaedd (patch) | |
| tree | 7561cdf761a5c22a411e9788553e09c260b57a87 | |
| parent | a7e88f857069fbefeb27f35499dc2b2d0f7b8564 (diff) | |
| download | bcm5719-llvm-e756730c23ef490abd4441acc40a70024bbfaedd.tar.gz bcm5719-llvm-e756730c23ef490abd4441acc40a70024bbfaedd.zip | |
[asan] Replace assignments with internal_memcpy ErrorDescription
For consistency with nearby code and to avoid interceptors during reports.
llvm-svn: 361304
| -rw-r--r-- | compiler-rt/lib/asan/asan_errors.h | 6 | ||||
| -rw-r--r-- | compiler-rt/lib/asan/asan_report.cc | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/compiler-rt/lib/asan/asan_errors.h b/compiler-rt/lib/asan/asan_errors.h index f0939ae3293..364b361d241 100644 --- a/compiler-rt/lib/asan/asan_errors.h +++ b/compiler-rt/lib/asan/asan_errors.h @@ -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(); diff --git a/compiler-rt/lib/asan/asan_report.cc b/compiler-rt/lib/asan/asan_report.cc index 551753b4a14..49067437d9d 100644 --- a/compiler-rt/lib/asan/asan_report.cc +++ b/compiler-rt/lib/asan/asan_report.cc @@ -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(¤t_error_, &description, sizeof(current_error_)); } static ErrorDescription &CurrentError() { |

