llvm/compiler-rt/lib/asan/asan_errors.h

//===-- asan_errors.h -------------------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file is a part of AddressSanitizer, an address sanity checker.
//
// ASan-private header for error structures.
//===----------------------------------------------------------------------===//
#ifndef ASAN_ERRORS_H
#define ASAN_ERRORS_H

#include "asan_descriptions.h"
#include "asan_scariness_score.h"
#include "sanitizer_common/sanitizer_common.h"

namespace __asan {

// (*) VS2013 does not implement unrestricted unions, so we need a trivial
// default constructor explicitly defined for each particular error.

// None of the error classes own the stack traces mentioned in them.

struct ErrorBase {};

struct ErrorDeadlySignal : ErrorBase {};

struct ErrorDoubleFree : ErrorBase {};

struct ErrorNewDeleteTypeMismatch : ErrorBase {};

struct ErrorFreeNotMalloced : ErrorBase {};

struct ErrorAllocTypeMismatch : ErrorBase {};

struct ErrorMallocUsableSizeNotOwned : ErrorBase {};

struct ErrorSanitizerGetAllocatedSizeNotOwned : ErrorBase {};

struct ErrorCallocOverflow : ErrorBase {};

struct ErrorReallocArrayOverflow : ErrorBase {};

struct ErrorPvallocOverflow : ErrorBase {};

struct ErrorInvalidAllocationAlignment : ErrorBase {};

struct ErrorInvalidAlignedAllocAlignment : ErrorBase {};

struct ErrorInvalidPosixMemalignAlignment : ErrorBase {};

struct ErrorAllocationSizeTooBig : ErrorBase {};

struct ErrorRssLimitExceeded : ErrorBase {};

struct ErrorOutOfMemory : ErrorBase {};

struct ErrorStringFunctionMemoryRangesOverlap : ErrorBase {};

struct ErrorStringFunctionSizeOverflow : ErrorBase {};

struct ErrorBadParamsToAnnotateContiguousContainer : ErrorBase {};

struct ErrorBadParamsToAnnotateDoubleEndedContiguousContainer : ErrorBase {};

struct ErrorODRViolation : ErrorBase {};

struct ErrorInvalidPointerPair : ErrorBase {};

struct ErrorGeneric : ErrorBase {};

// clang-format off
#define ASAN_FOR_EACH_ERROR_KIND
// clang-format on

#define ASAN_DEFINE_ERROR_KIND
#define ASAN_ERROR_DESCRIPTION_MEMBER
#define ASAN_ERROR_DESCRIPTION_CONSTRUCTOR
#define ASAN_ERROR_DESCRIPTION_PRINT

enum ErrorKind {};

struct ErrorDescription {};

#undef ASAN_FOR_EACH_ERROR_KIND
#undef ASAN_DEFINE_ERROR_KIND
#undef ASAN_ERROR_DESCRIPTION_MEMBER
#undef ASAN_ERROR_DESCRIPTION_CONSTRUCTOR
#undef ASAN_ERROR_DESCRIPTION_PRINT

}  // namespace __asan

#endif  // ASAN_ERRORS_H