Sanitizers.def revision 280031
1//===--- Sanitizers.def - Runtime sanitizer options -------------*- C++ -*-===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
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.
14//
15//===----------------------------------------------------------------------===//
16
17#ifndef SANITIZER
18#error "Define SANITIZER prior to including this file!"
19#endif
20
21// SANITIZER(NAME, ID)
22
23// The first value is the name of the sanitizer as a string. The sanitizer can
24// be enabled by specifying -fsanitize=NAME.
25
26// The second value is an identifier which can be used to refer to the
27// sanitizer.
28
29
30// SANITIZER_GROUP(NAME, ID, ALIAS)
31
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.
35
36#ifndef SANITIZER_GROUP
37#define SANITIZER_GROUP(NAME, ID, ALIAS)
38#endif
39
40
41// AddressSanitizer
42SANITIZER("address", Address)
43
44// MemorySanitizer
45SANITIZER("memory", Memory)
46
47// ThreadSanitizer
48SANITIZER("thread", Thread)
49
50// LeakSanitizer
51SANITIZER("leak", Leak)
52
53// UndefinedBehaviorSanitizer
54SANITIZER("alignment", Alignment)
55SANITIZER("array-bounds", ArrayBounds)
56SANITIZER("bool", Bool)
57SANITIZER("enum", Enum)
58SANITIZER("float-cast-overflow", FloatCastOverflow)
59SANITIZER("float-divide-by-zero", FloatDivideByZero)
60SANITIZER("function", Function)
61SANITIZER("integer-divide-by-zero", IntegerDivideByZero)
62SANITIZER("nonnull-attribute", NonnullAttribute)
63SANITIZER("null", Null)
64SANITIZER("object-size", ObjectSize)
65SANITIZER("return", Return)
66SANITIZER("returns-nonnull-attribute", ReturnsNonnullAttribute)
67SANITIZER("shift", Shift)
68SANITIZER("signed-integer-overflow", SignedIntegerOverflow)
69SANITIZER("unreachable", Unreachable)
70SANITIZER("vla-bound", VLABound)
71SANITIZER("vptr", Vptr)
72
73// IntegerSanitizer
74SANITIZER("unsigned-integer-overflow", UnsignedIntegerOverflow)
75
76// DataFlowSanitizer
77SANITIZER("dataflow", DataFlow)
78
79// -fsanitize=undefined includes all the sanitizers which have low overhead, no
80// ABI or address space layout implications, and only catch undefined behavior.
81SANITIZER_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)
87
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.
92SANITIZER_GROUP("undefined-trap", UndefinedTrap,
93                Alignment | Bool | ArrayBounds | Enum | FloatCastOverflow |
94                    FloatDivideByZero | IntegerDivideByZero | NonnullAttribute |
95                    Null | ObjectSize | Return | ReturnsNonnullAttribute |
96                    Shift | SignedIntegerOverflow | Unreachable | VLABound)
97
98SANITIZER_GROUP("integer", Integer,
99                SignedIntegerOverflow | UnsignedIntegerOverflow | Shift |
100                IntegerDivideByZero)
101
102SANITIZER("local-bounds", LocalBounds)
103SANITIZER_GROUP("bounds", Bounds, ArrayBounds | LocalBounds)
104
105// Magic group, containing all sanitizers. For example, "-fno-sanitize=all"
106// can be used to disable all the sanitizers.
107SANITIZER_GROUP("all", All, ~0)
108
109#undef SANITIZER
110#undef SANITIZER_GROUP
111