//===-- ubsan_diag.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 // //===----------------------------------------------------------------------===// // // Diagnostics emission for Clang's undefined behavior sanitizer. // //===----------------------------------------------------------------------===// #ifndef UBSAN_DIAG_H #define UBSAN_DIAG_H #include "ubsan_value.h" #include "sanitizer_common/sanitizer_stacktrace.h" #include "sanitizer_common/sanitizer_symbolizer.h" namespace __ubsan { SymbolizedStack *getSymbolizedLocation(uptr PC); inline SymbolizedStack *getCallerLocation(uptr CallerPC) { … } /// A location of some data within the program's address space. MemoryLocation; /// \brief Location at which a diagnostic can be emitted. Either a /// SourceLocation, a MemoryLocation, or a SymbolizedStack. class Location { … }; /// A diagnostic severity level. enum DiagLevel { … }; /// \brief Annotation for a range of locations in a diagnostic. class Range { … }; /// \brief A C++ type name. Really just a strong typedef for 'const char*'. class TypeName { … }; enum class ErrorType { … }; /// \brief Representation of an in-flight diagnostic. /// /// Temporary \c Diag instances are created by the handler routines to /// accumulate arguments for a diagnostic. The destructor emits the diagnostic /// message. class Diag { … }; struct ReportOptions { … }; bool ignoreReport(SourceLocation SLoc, ReportOptions Opts, ErrorType ET); #define GET_REPORT_OPTIONS(unrecoverable_handler) … /// \brief Instantiate this class before printing diagnostics in the error /// report. This class ensures that reports from different threads and from /// different sanitizers won't be mixed. class ScopedReport { … }; void InitializeSuppressions(); bool IsVptrCheckSuppressed(const char *TypeName); // Sometimes UBSan runtime can know filename from handlers arguments, even if // debug info is missing. bool IsPCSuppressed(ErrorType ET, uptr PC, const char *Filename); } // namespace __ubsan #endif // UBSAN_DIAG_H