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)
45 SANITIZER("memory", Memory)
48 SANITIZER("thread", Thread)
51 SANITIZER("leak", Leak)
53 // UndefinedBehaviorSanitizer
54 SANITIZER("alignment", Alignment)
55 SANITIZER("array-bounds", ArrayBounds)
56 SANITIZER("bool", Bool)
57 SANITIZER("enum", Enum)
58 SANITIZER("float-cast-overflow", FloatCastOverflow)
59 SANITIZER("float-divide-by-zero", FloatDivideByZero)
60 SANITIZER("function", Function)
61 SANITIZER("integer-divide-by-zero", IntegerDivideByZero)
62 SANITIZER("nonnull-attribute", NonnullAttribute)
63 SANITIZER("null", Null)
64 SANITIZER("object-size", ObjectSize)
65 SANITIZER("return", Return)
66 SANITIZER("returns-nonnull-attribute", ReturnsNonnullAttribute)
67 SANITIZER("shift", Shift)
68 SANITIZER("signed-integer-overflow", SignedIntegerOverflow)
69 SANITIZER("unreachable", Unreachable)
70 SANITIZER("vla-bound", VLABound)
71 SANITIZER("vptr", Vptr)
74 SANITIZER("unsigned-integer-overflow", UnsignedIntegerOverflow)
77 SANITIZER("dataflow", DataFlow)
79 // -fsanitize=undefined includes all the sanitizers which have low overhead, no
80 // ABI or address space layout implications, and only catch undefined behavior.
81 SANITIZER_GROUP("undefined", Undefined,
82 Alignment | Bool | ArrayBounds | Enum | FloatCastOverflow |
83 FloatDivideByZero | Function | IntegerDivideByZero |
84 NonnullAttribute | Null | ObjectSize | Return |
85 ReturnsNonnullAttribute | Shift | SignedIntegerOverflow |
86 Unreachable | VLABound | Vptr)
88 // -fsanitize=undefined-trap includes
89 // all sanitizers included by -fsanitize=undefined, except those that require
90 // runtime support. This group is generally used in conjunction with the
91 // -fsanitize-undefined-trap-on-error flag.
92 SANITIZER_GROUP("undefined-trap", UndefinedTrap,
93 Alignment | Bool | ArrayBounds | Enum | FloatCastOverflow |
94 FloatDivideByZero | IntegerDivideByZero | NonnullAttribute |
95 Null | ObjectSize | Return | ReturnsNonnullAttribute |
96 Shift | SignedIntegerOverflow | Unreachable | VLABound)
98 SANITIZER_GROUP("integer", Integer,
99 SignedIntegerOverflow | UnsignedIntegerOverflow | Shift |
102 SANITIZER("local-bounds", LocalBounds)
103 SANITIZER_GROUP("bounds", Bounds, ArrayBounds | LocalBounds)
105 // Magic group, containing all sanitizers. For example, "-fno-sanitize=all"
106 // can be used to disable all the sanitizers.
107 SANITIZER_GROUP("all", All, ~0)
110 #undef SANITIZER_GROUP