1 //===-- ubsan_flags.h -------------------------------------------*- C++ -*-===//
2 //
3 // This file is distributed under the University of Illinois Open Source
4 // License. See LICENSE.TXT for details.
5 //
6 //===----------------------------------------------------------------------===//
7 //
8 // Runtime flags for UndefinedBehaviorSanitizer.
9 //
10 //===----------------------------------------------------------------------===//
11 #ifndef UBSAN_FLAGS_H
12 #define UBSAN_FLAGS_H
13 
14 #include "sanitizer_common/sanitizer_internal_defs.h"
15 
16 namespace __sanitizer {
17 class FlagParser;
18 }
19 
20 namespace __ubsan {
21 
22 struct Flags {
23 #define UBSAN_FLAG(Type, Name, DefaultValue, Description) Type Name;
24 #include "ubsan_flags.inc"
25 #undef UBSAN_FLAG
26 
27   void SetDefaults();
28 };
29 
30 extern Flags ubsan_flags;
flags()31 inline Flags *flags() { return &ubsan_flags; }
32 
33 void InitializeFlags();
34 void RegisterUbsanFlags(FlagParser *parser, Flags *f);
35 
36 const char *MaybeCallUbsanDefaultOptions();
37 
38 }  // namespace __ubsan
39 
40 extern "C" {
41 // Users may provide their own implementation of __ubsan_default_options to
42 // override the default flag values.
43 SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE
44 const char *__ubsan_default_options();
45 }  // extern "C"
46 
47 #endif  // UBSAN_FLAGS_H
48