ubsan_flags.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. //===-- ubsan_flags.h -------------------------------------------*- 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. // Runtime flags for UndefinedBehaviorSanitizer.
  10. //
  11. //===----------------------------------------------------------------------===//
  12. #ifndef UBSAN_FLAGS_H
  13. #define UBSAN_FLAGS_H
  14. #include "sanitizer_common/sanitizer_internal_defs.h"
  15. namespace __sanitizer {
  16. class FlagParser;
  17. }
  18. namespace __ubsan {
  19. struct Flags {
  20. #define UBSAN_FLAG(Type, Name, DefaultValue, Description) Type Name;
  21. #include "ubsan_flags.inc"
  22. #undef UBSAN_FLAG
  23. void SetDefaults();
  24. };
  25. extern Flags ubsan_flags;
  26. inline Flags *flags() { return &ubsan_flags; }
  27. void InitializeFlags();
  28. void RegisterUbsanFlags(FlagParser *parser, Flags *f);
  29. } // namespace __ubsan
  30. extern "C" {
  31. // Users may provide their own implementation of __ubsan_default_options to
  32. // override the default flag values.
  33. SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE
  34. const char *__ubsan_default_options();
  35. } // extern "C"
  36. #endif // UBSAN_FLAGS_H