Sanitizers.def revision 280031
1243791Sdim//===--- Sanitizers.def - Runtime sanitizer options -------------*- C++ -*-===//
2243791Sdim//
3243791Sdim//                     The LLVM Compiler Infrastructure
4243791Sdim//
5243791Sdim// This file is distributed under the University of Illinois Open Source
6243791Sdim// License. See LICENSE.TXT for details.
7243791Sdim//
8243791Sdim//===----------------------------------------------------------------------===//
9243791Sdim//
10243791Sdim// This file defines the options for specifying which runtime sanitizers to
11243791Sdim// enable. Users of this file must define the SANITIZER macro to make use of
12243791Sdim// this information. Users of this file can also define the SANITIZER_GROUP
13243791Sdim// macro to get information on options which refer to sets of sanitizers.
14243791Sdim//
15243791Sdim//===----------------------------------------------------------------------===//
16243791Sdim
17243791Sdim#ifndef SANITIZER
18243791Sdim#error "Define SANITIZER prior to including this file!"
19243791Sdim#endif
20243791Sdim
21243791Sdim// SANITIZER(NAME, ID)
22243791Sdim
23243791Sdim// The first value is the name of the sanitizer as a string. The sanitizer can
24243791Sdim// be enabled by specifying -fsanitize=NAME.
25243791Sdim
26243791Sdim// The second value is an identifier which can be used to refer to the
27243791Sdim// sanitizer.
28243791Sdim
29243791Sdim
30243791Sdim// SANITIZER_GROUP(NAME, ID, ALIAS)
31243791Sdim
32243791Sdim// The first two values have the same semantics as the corresponding SANITIZER
33243791Sdim// values. The third value is an expression ORing together the IDs of individual
34243791Sdim// sanitizers in this group.
35243791Sdim
36243791Sdim#ifndef SANITIZER_GROUP
37243791Sdim#define SANITIZER_GROUP(NAME, ID, ALIAS)
38243791Sdim#endif
39243791Sdim
40243791Sdim
41243791Sdim// AddressSanitizer
42243791SdimSANITIZER("address", Address)
43243791Sdim
44249423Sdim// MemorySanitizer
45249423SdimSANITIZER("memory", Memory)
46249423Sdim
47243791Sdim// ThreadSanitizer
48243791SdimSANITIZER("thread", Thread)
49243791Sdim
50261991Sdim// LeakSanitizer
51261991SdimSANITIZER("leak", Leak)
52261991Sdim
53243791Sdim// UndefinedBehaviorSanitizer
54249423SdimSANITIZER("alignment", Alignment)
55261991SdimSANITIZER("array-bounds", ArrayBounds)
56249423SdimSANITIZER("bool", Bool)
57249423SdimSANITIZER("enum", Enum)
58249423SdimSANITIZER("float-cast-overflow", FloatCastOverflow)
59249423SdimSANITIZER("float-divide-by-zero", FloatDivideByZero)
60261991SdimSANITIZER("function", Function)
61249423SdimSANITIZER("integer-divide-by-zero", IntegerDivideByZero)
62280031SdimSANITIZER("nonnull-attribute", NonnullAttribute)
63249423SdimSANITIZER("null", Null)
64249423SdimSANITIZER("object-size", ObjectSize)
65249423SdimSANITIZER("return", Return)
66280031SdimSANITIZER("returns-nonnull-attribute", ReturnsNonnullAttribute)
67249423SdimSANITIZER("shift", Shift)
68243791SdimSANITIZER("signed-integer-overflow", SignedIntegerOverflow)
69243791SdimSANITIZER("unreachable", Unreachable)
70243791SdimSANITIZER("vla-bound", VLABound)
71243791SdimSANITIZER("vptr", Vptr)
72243791Sdim
73249423Sdim// IntegerSanitizer
74249423SdimSANITIZER("unsigned-integer-overflow", UnsignedIntegerOverflow)
75249423Sdim
76261991Sdim// DataFlowSanitizer
77261991SdimSANITIZER("dataflow", DataFlow)
78261991Sdim
79249423Sdim// -fsanitize=undefined includes all the sanitizers which have low overhead, no
80249423Sdim// ABI or address space layout implications, and only catch undefined behavior.
81243791SdimSANITIZER_GROUP("undefined", Undefined,
82261991Sdim                Alignment | Bool | ArrayBounds | Enum | FloatCastOverflow |
83280031Sdim                    FloatDivideByZero | Function | IntegerDivideByZero |
84280031Sdim                    NonnullAttribute | Null | ObjectSize | Return |
85280031Sdim                    ReturnsNonnullAttribute | Shift | SignedIntegerOverflow |
86280031Sdim                    Unreachable | VLABound | Vptr)
87243791Sdim
88276479Sdim// -fsanitize=undefined-trap includes
89249423Sdim// all sanitizers included by -fsanitize=undefined, except those that require
90249423Sdim// runtime support.  This group is generally used in conjunction with the
91249423Sdim// -fsanitize-undefined-trap-on-error flag.
92249423SdimSANITIZER_GROUP("undefined-trap", UndefinedTrap,
93261991Sdim                Alignment | Bool | ArrayBounds | Enum | FloatCastOverflow |
94280031Sdim                    FloatDivideByZero | IntegerDivideByZero | NonnullAttribute |
95280031Sdim                    Null | ObjectSize | Return | ReturnsNonnullAttribute |
96280031Sdim                    Shift | SignedIntegerOverflow | Unreachable | VLABound)
97249423Sdim
98249423SdimSANITIZER_GROUP("integer", Integer,
99249423Sdim                SignedIntegerOverflow | UnsignedIntegerOverflow | Shift |
100249423Sdim                IntegerDivideByZero)
101249423Sdim
102261991SdimSANITIZER("local-bounds", LocalBounds)
103261991SdimSANITIZER_GROUP("bounds", Bounds, ArrayBounds | LocalBounds)
104261991Sdim
105280031Sdim// Magic group, containing all sanitizers. For example, "-fno-sanitize=all"
106280031Sdim// can be used to disable all the sanitizers.
107280031SdimSANITIZER_GROUP("all", All, ~0)
108280031Sdim
109243791Sdim#undef SANITIZER
110243791Sdim#undef SANITIZER_GROUP
111