ubsan.h revision 1.7 1 1.1 mrg /* UndefinedBehaviorSanitizer, undefined behavior detector.
2 1.7 mrg Copyright (C) 2013-2022 Free Software Foundation, Inc.
3 1.1 mrg Contributed by Marek Polacek <polacek (at) redhat.com>
4 1.1 mrg
5 1.1 mrg This file is part of GCC.
6 1.1 mrg
7 1.1 mrg GCC is free software; you can redistribute it and/or modify it under
8 1.1 mrg the terms of the GNU General Public License as published by the Free
9 1.1 mrg Software Foundation; either version 3, or (at your option) any later
10 1.1 mrg version.
11 1.1 mrg
12 1.1 mrg GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 1.1 mrg WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 1.1 mrg FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 1.1 mrg for more details.
16 1.1 mrg
17 1.1 mrg You should have received a copy of the GNU General Public License
18 1.1 mrg along with GCC; see the file COPYING3. If not see
19 1.1 mrg <http://www.gnu.org/licenses/>. */
20 1.1 mrg
21 1.1 mrg #ifndef GCC_UBSAN_H
22 1.1 mrg #define GCC_UBSAN_H
23 1.1 mrg
24 1.1 mrg /* The various kinds of NULL pointer checks. */
25 1.1 mrg enum ubsan_null_ckind {
26 1.1 mrg UBSAN_LOAD_OF,
27 1.1 mrg UBSAN_STORE_OF,
28 1.1 mrg UBSAN_REF_BINDING,
29 1.1 mrg UBSAN_MEMBER_ACCESS,
30 1.1 mrg UBSAN_MEMBER_CALL,
31 1.1 mrg UBSAN_CTOR_CALL,
32 1.1 mrg UBSAN_DOWNCAST_POINTER,
33 1.1 mrg UBSAN_DOWNCAST_REFERENCE,
34 1.1 mrg UBSAN_UPCAST,
35 1.1 mrg UBSAN_CAST_TO_VBASE
36 1.1 mrg };
37 1.1 mrg
38 1.1 mrg /* This controls how ubsan prints types. Used in ubsan_type_descriptor. */
39 1.1 mrg enum ubsan_print_style {
40 1.1 mrg UBSAN_PRINT_NORMAL,
41 1.1 mrg UBSAN_PRINT_POINTER,
42 1.1 mrg UBSAN_PRINT_ARRAY
43 1.1 mrg };
44 1.1 mrg
45 1.3 mrg /* This controls ubsan_encode_value behavior. */
46 1.3 mrg enum ubsan_encode_value_phase {
47 1.3 mrg UBSAN_ENCODE_VALUE_GENERIC,
48 1.3 mrg UBSAN_ENCODE_VALUE_GIMPLE,
49 1.3 mrg UBSAN_ENCODE_VALUE_RTL
50 1.3 mrg };
51 1.3 mrg
52 1.1 mrg extern bool ubsan_expand_bounds_ifn (gimple_stmt_iterator *);
53 1.1 mrg extern bool ubsan_expand_null_ifn (gimple_stmt_iterator *);
54 1.1 mrg extern bool ubsan_expand_objsize_ifn (gimple_stmt_iterator *);
55 1.4 mrg extern bool ubsan_expand_ptr_ifn (gimple_stmt_iterator *);
56 1.1 mrg extern bool ubsan_expand_vptr_ifn (gimple_stmt_iterator *);
57 1.1 mrg extern bool ubsan_instrument_unreachable (gimple_stmt_iterator *);
58 1.1 mrg extern tree ubsan_create_data (const char *, int, const location_t *, ...);
59 1.3 mrg extern tree ubsan_type_descriptor (tree, ubsan_print_style
60 1.3 mrg = UBSAN_PRINT_NORMAL);
61 1.3 mrg extern tree ubsan_encode_value (tree, ubsan_encode_value_phase
62 1.3 mrg = UBSAN_ENCODE_VALUE_GENERIC);
63 1.1 mrg extern bool is_ubsan_builtin_p (tree);
64 1.3 mrg extern tree ubsan_build_overflow_builtin (tree_code, location_t, tree, tree,
65 1.3 mrg tree, tree *);
66 1.3 mrg extern tree ubsan_instrument_float_cast (location_t, tree, tree);
67 1.1 mrg extern tree ubsan_get_source_location_type (void);
68 1.1 mrg
69 1.1 mrg #endif /* GCC_UBSAN_H */
70