clang 22.0.0git
SanitizerHandler.h
Go to the documentation of this file.
1//===-- SanitizerHandler.h - Definition of sanitizer handlers ---*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This is the internal per-function state used for llvm translation.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_CLANG_LIB_CODEGEN_SANITIZER_HANDLER_H
14#define LLVM_CLANG_LIB_CODEGEN_SANITIZER_HANDLER_H
15
16#define LIST_SANITIZER_CHECKS \
17 SANITIZER_CHECK(AddOverflow, add_overflow, 0, "Integer addition overflowed") \
18 SANITIZER_CHECK(BuiltinUnreachable, builtin_unreachable, 0, \
19 "_builtin_unreachable(), execution reached an unreachable " \
20 "program point") \
21 SANITIZER_CHECK(CFICheckFail, cfi_check_fail, 0, \
22 "Control flow integrity check failed") \
23 SANITIZER_CHECK(DivremOverflow, divrem_overflow, 0, \
24 "Integer divide or remainder overflowed") \
25 SANITIZER_CHECK(DynamicTypeCacheMiss, dynamic_type_cache_miss, 0, \
26 "Dynamic type cache miss, member call made on an object " \
27 "whose dynamic type differs from the expected type") \
28 SANITIZER_CHECK(FloatCastOverflow, float_cast_overflow, 0, \
29 "Floating-point to integer conversion overflowed") \
30 SANITIZER_CHECK(FunctionTypeMismatch, function_type_mismatch, 0, \
31 "Function called with mismatched signature") \
32 SANITIZER_CHECK(ImplicitConversion, implicit_conversion, 0, \
33 "Implicit integer conversion overflowed or lost data") \
34 SANITIZER_CHECK(InvalidBuiltin, invalid_builtin, 0, \
35 "Invalid use of builtin function") \
36 SANITIZER_CHECK(InvalidObjCCast, invalid_objc_cast, 0, \
37 "Invalid Objective-C cast") \
38 SANITIZER_CHECK(LoadInvalidValue, load_invalid_value, 0, \
39 "Loaded an invalid or uninitialized value for the type") \
40 SANITIZER_CHECK(MissingReturn, missing_return, 0, \
41 "Execution reached the end of a value-returning function " \
42 "without returning a value") \
43 SANITIZER_CHECK(MulOverflow, mul_overflow, 0, \
44 "Integer multiplication overflowed") \
45 SANITIZER_CHECK(NegateOverflow, negate_overflow, 0, \
46 "Integer negation overflowed") \
47 SANITIZER_CHECK( \
48 NullabilityArg, nullability_arg, 0, \
49 "Passing null as an argument which is annotated with _Nonnull") \
50 SANITIZER_CHECK(NullabilityReturn, nullability_return, 1, \
51 "Returning null from a function with a return type " \
52 "annotated with _Nonnull") \
53 SANITIZER_CHECK(NonnullArg, nonnull_arg, 0, \
54 "Passing null pointer as an argument which is declared to " \
55 "never be null") \
56 SANITIZER_CHECK(NonnullReturn, nonnull_return, 1, \
57 "Returning null pointer from a function which is declared " \
58 "to never return null") \
59 SANITIZER_CHECK(OutOfBounds, out_of_bounds, 0, "Array index out of bounds") \
60 SANITIZER_CHECK(PointerOverflow, pointer_overflow, 0, \
61 "Pointer arithmetic overflowed bounds") \
62 SANITIZER_CHECK(ShiftOutOfBounds, shift_out_of_bounds, 0, \
63 "Shift exponent is too large for the type") \
64 SANITIZER_CHECK(SubOverflow, sub_overflow, 0, \
65 "Integer subtraction overflowed") \
66 SANITIZER_CHECK(TypeMismatch, type_mismatch, 1, \
67 "Type mismatch in operation") \
68 SANITIZER_CHECK(AlignmentAssumption, alignment_assumption, 0, \
69 "Alignment assumption violated") \
70 SANITIZER_CHECK( \
71 VLABoundNotPositive, vla_bound_not_positive, 0, \
72 "Variable length array bound evaluates to non-positive value") \
73 SANITIZER_CHECK(BoundsSafety, bounds_safety, 0, \
74 "") // BoundsSafety Msg is empty because it is not considered
75 // part of UBSan; therefore, no trap reason is emitted for
76 // this case.
77
79#define SANITIZER_CHECK(Enum, Name, Version, Msg) Enum,
81#undef SANITIZER_CHECK
82};
83
84#endif // LLVM_CLANG_LIB_CODEGEN_SANITIZER_HANDLER_H
#define LIST_SANITIZER_CHECKS
SanitizerHandler