llvm/compiler-rt/lib/ubsan/ubsan_diag.cpp

//===-- ubsan_diag.cpp ----------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//
//
// Diagnostic reporting for the UBSan runtime.
//
//===----------------------------------------------------------------------===//

#include "ubsan_platform.h"
#if CAN_SANITIZE_UB
#include "ubsan_diag.h"
#include "ubsan_init.h"
#include "ubsan_flags.h"
#include "ubsan_monitor.h"
#include "sanitizer_common/sanitizer_placement_new.h"
#include "sanitizer_common/sanitizer_report_decorator.h"
#include "sanitizer_common/sanitizer_stacktrace.h"
#include "sanitizer_common/sanitizer_stacktrace_printer.h"
#include "sanitizer_common/sanitizer_suppressions.h"
#include "sanitizer_common/sanitizer_symbolizer.h"
#include <stdio.h>

usingnamespace__ubsan;

// UBSan is combined with runtimes that already provide this functionality
// (e.g., ASan) as well as runtimes that lack it (e.g., scudo). Tried to use
// weak linkage to resolve this issue which is not portable and breaks on
// Windows.
// TODO(yln): This is a temporary workaround. GetStackTrace functions will be
// removed in the future.
void ubsan_GetStackTrace(BufferedStackTrace *stack, uptr max_depth, uptr pc,
                         uptr bp, void *context, bool request_fast) {}

static void MaybePrintStackTrace(uptr pc, uptr bp) {}

static const char *ConvertTypeToString(ErrorType Type) {}

static const char *ConvertTypeToFlagName(ErrorType Type) {}

static void MaybeReportErrorSummary(Location Loc, ErrorType Type) {}

namespace {
class Decorator : public SanitizerCommonDecorator {};
}

SymbolizedStack *__ubsan::getSymbolizedLocation(uptr PC) {}

Diag &Diag::operator<<(const TypeDescriptor &V) {}

Diag &Diag::operator<<(const Value &V) {}

/// Hexadecimal printing for numbers too large for Printf to handle directly.
static void RenderHex(InternalScopedString *Buffer, UIntMax Val) {}

static void RenderLocation(InternalScopedString *Buffer, Location Loc) {}

static void RenderText(InternalScopedString *Buffer, const char *Message,
                       const Diag::Arg *Args) {}

/// Find the earliest-starting range in Ranges which ends after Loc.
static Range *upperBound(MemoryLocation Loc, Range *Ranges,
                         unsigned NumRanges) {}

static inline uptr subtractNoOverflow(uptr LHS, uptr RHS) {}

static inline uptr addNoOverflow(uptr LHS, uptr RHS) {}

/// Render a snippet of the address space near a location.
static void PrintMemorySnippet(const Decorator &Decor, MemoryLocation Loc,
                               Range *Ranges, unsigned NumRanges,
                               const Diag::Arg *Args) {}

Diag::~Diag() {}

ScopedReport::Initializer::Initializer() {}

ScopedReport::ScopedReport(ReportOptions Opts, Location SummaryLoc,
                           ErrorType Type)
    :{}

ScopedReport::~ScopedReport() {}

alignas(64) static char suppression_placeholder[sizeof(SuppressionContext)];
static SuppressionContext *suppression_ctx =;
static const char kVptrCheck[] =;
static const char *kSuppressionTypes[] =;

void __ubsan::InitializeSuppressions() {}

bool __ubsan::IsVptrCheckSuppressed(const char *TypeName) {}

bool __ubsan::IsPCSuppressed(ErrorType ET, uptr PC, const char *Filename) {}

#endif  // CAN_SANITIZE_UB