Index: lib/asan/asan_errors.h =================================================================== --- lib/asan/asan_errors.h +++ lib/asan/asan_errors.h @@ -21,19 +21,21 @@ namespace __asan { struct ErrorBase { + ErrorBase() = default; + explicit ErrorBase(u32 tid_) : tid(tid_) {} ScarinessScoreBase scariness; + u32 tid; }; struct ErrorStackOverflow : ErrorBase { - u32 tid; uptr addr, pc, bp, sp; // ErrorStackOverflow never owns the context. void *context; // VS2013 doesn't implement unrestricted unions, so we need a trivial default // constructor ErrorStackOverflow() = default; - ErrorStackOverflow(const SignalContext &sig, u32 tid_) - : tid(tid_), + ErrorStackOverflow(const SignalContext &sig, u32 tid) + : ErrorBase(tid), addr(sig.addr), pc(sig.pc), bp(sig.bp), @@ -46,7 +48,6 @@ }; struct ErrorDeadlySignal : ErrorBase { - u32 tid; uptr addr, pc, bp, sp; int signo; SignalContext::WriteFlag write_flag; @@ -56,8 +57,8 @@ // VS2013 doesn't implement unrestricted unions, so we need a trivial default // constructor ErrorDeadlySignal() = default; - ErrorDeadlySignal(int signo_, const SignalContext &sig, u32 tid_) - : tid(tid_), + ErrorDeadlySignal(int signo_, const SignalContext &sig, u32 tid) + : ErrorBase(tid), addr(sig.addr), pc(sig.pc), bp(sig.bp), @@ -87,15 +88,14 @@ }; struct ErrorDoubleFree : ErrorBase { - u32 tid; HeapAddressDescription addr_description; // ErrorDoubleFree doesn't own the stack trace. BufferedStackTrace *second_free_stack; // VS2013 doesn't implement unrestricted unions, so we need a trivial default // constructor ErrorDoubleFree() = default; - ErrorDoubleFree(uptr addr, u32 tid_, BufferedStackTrace *stack) - : tid(tid_), second_free_stack(stack) { + ErrorDoubleFree(uptr addr, u32 tid, BufferedStackTrace *stack) + : ErrorBase(tid), second_free_stack(stack) { CHECK_GT(second_free_stack->size, 0); GetHeapAddressInformation(addr, 1, &addr_description); scariness.Clear(); @@ -105,7 +105,6 @@ }; struct ErrorNewDeleteSizeMismatch : ErrorBase { - u32 tid; HeapAddressDescription addr_description; uptr delete_size; // ErrorNewDeleteSizeMismatch doesn't own the stack trace. @@ -113,9 +112,9 @@ // VS2013 doesn't implement unrestricted unions, so we need a trivial default // constructor ErrorNewDeleteSizeMismatch() = default; - ErrorNewDeleteSizeMismatch(uptr addr, u32 tid_, uptr delete_size_, + ErrorNewDeleteSizeMismatch(uptr addr, u32 tid, uptr delete_size_, BufferedStackTrace *stack) - : tid(tid_), delete_size(delete_size_), free_stack(stack) { + : ErrorBase(tid), delete_size(delete_size_), free_stack(stack) { GetHeapAddressInformation(addr, 1, &addr_description); scariness.Clear(); scariness.Scare(10, "new-delete-type-mismatch");