ubsan.h 2.1 KB

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