1 //===--- Sanitizers.def - Runtime sanitizer options -------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines the options for specifying which runtime sanitizers to
11 // enable. Users of this file must define the SANITIZER macro to make use of
12 // this information. Users of this file can also define the SANITIZER_GROUP
13 // macro to get information on options which refer to sets of sanitizers.
15 //===----------------------------------------------------------------------===//
18 #error "Define SANITIZER prior to including this file!"
21 // SANITIZER(NAME, ID)
23 // The first value is the name of the sanitizer as a string. The sanitizer can
24 // be enabled by specifying -fsanitize=NAME.
26 // The second value is an identifier which can be used to refer to the
30 // SANITIZER_GROUP(NAME, ID, ALIAS)
32 // The first two values have the same semantics as the corresponding SANITIZER
33 // values. The third value is an expression ORing together the IDs of individual
34 // sanitizers in this group.
36 #ifndef SANITIZER_GROUP
37 #define SANITIZER_GROUP(NAME, ID, ALIAS)
42 SANITIZER("address", Address)
43 // More features of AddressSanitizer that should be turned on explicitly.
44 SANITIZER("init-order", InitOrder)
45 SANITIZER("use-after-return", UseAfterReturn)
46 SANITIZER("use-after-scope", UseAfterScope)
48 SANITIZER_GROUP("address-full", AddressFull,
49 Address | InitOrder | UseAfterReturn | UseAfterScope)
52 SANITIZER("memory", Memory)
55 SANITIZER("thread", Thread)
58 SANITIZER("leak", Leak)
60 // UndefinedBehaviorSanitizer
61 SANITIZER("alignment", Alignment)
62 SANITIZER("array-bounds", ArrayBounds)
63 SANITIZER("bool", Bool)
64 SANITIZER("enum", Enum)
65 SANITIZER("float-cast-overflow", FloatCastOverflow)
66 SANITIZER("float-divide-by-zero", FloatDivideByZero)
67 SANITIZER("function", Function)
68 SANITIZER("integer-divide-by-zero", IntegerDivideByZero)
69 SANITIZER("null", Null)
70 SANITIZER("object-size", ObjectSize)
71 SANITIZER("return", Return)
72 SANITIZER("shift", Shift)
73 SANITIZER("signed-integer-overflow", SignedIntegerOverflow)
74 SANITIZER("unreachable", Unreachable)
75 SANITIZER("vla-bound", VLABound)
76 SANITIZER("vptr", Vptr)
79 SANITIZER("unsigned-integer-overflow", UnsignedIntegerOverflow)
82 SANITIZER("dataflow", DataFlow)
84 // -fsanitize=undefined includes all the sanitizers which have low overhead, no
85 // ABI or address space layout implications, and only catch undefined behavior.
86 SANITIZER_GROUP("undefined", Undefined,
87 Alignment | Bool | ArrayBounds | Enum | FloatCastOverflow |
88 FloatDivideByZero | Function | IntegerDivideByZero | Null |
89 ObjectSize | Return | Shift | SignedIntegerOverflow |
90 Unreachable | VLABound | Vptr)
92 // -fsanitize=undefined-trap (and its alias -fcatch-undefined-behavior) includes
93 // all sanitizers included by -fsanitize=undefined, except those that require
94 // runtime support. This group is generally used in conjunction with the
95 // -fsanitize-undefined-trap-on-error flag.
96 SANITIZER_GROUP("undefined-trap", UndefinedTrap,
97 Alignment | Bool | ArrayBounds | Enum | FloatCastOverflow |
98 FloatDivideByZero | IntegerDivideByZero | Null | ObjectSize |
99 Return | Shift | SignedIntegerOverflow | Unreachable |
102 SANITIZER_GROUP("integer", Integer,
103 SignedIntegerOverflow | UnsignedIntegerOverflow | Shift |
107 SANITIZER("local-bounds", LocalBounds)
108 SANITIZER_GROUP("bounds", Bounds, ArrayBounds | LocalBounds)
111 #undef SANITIZER_GROUP