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// More features of AddressSanitizer that should be turned on explicitly.
44SANITIZER("init-order", InitOrder)
45SANITIZER("use-after-return", UseAfterReturn)
46SANITIZER("use-after-scope", UseAfterScope)
47
48SANITIZER_GROUP("address-full", AddressFull,
49                Address | InitOrder | UseAfterReturn | UseAfterScope)
50
51// MemorySanitizer
52SANITIZER("memory", Memory)
53
54// ThreadSanitizer
55SANITIZER("thread", Thread)
56
57// LeakSanitizer
58SANITIZER("leak", Leak)
59
60// UndefinedBehaviorSanitizer
61SANITIZER("alignment", Alignment)
62SANITIZER("array-bounds", ArrayBounds)
63SANITIZER("bool", Bool)
64SANITIZER("enum", Enum)
65SANITIZER("float-cast-overflow", FloatCastOverflow)
66SANITIZER("float-divide-by-zero", FloatDivideByZero)
67SANITIZER("function", Function)
68SANITIZER("integer-divide-by-zero", IntegerDivideByZero)
69SANITIZER("null", Null)
70SANITIZER("object-size", ObjectSize)
71SANITIZER("return", Return)
72SANITIZER("shift", Shift)
73SANITIZER("signed-integer-overflow", SignedIntegerOverflow)
74SANITIZER("unreachable", Unreachable)
75SANITIZER("vla-bound", VLABound)
76SANITIZER("vptr", Vptr)
77
78// IntegerSanitizer
79SANITIZER("unsigned-integer-overflow", UnsignedIntegerOverflow)
80
81// DataFlowSanitizer
82SANITIZER("dataflow", DataFlow)
83
84// -fsanitize=undefined includes all the sanitizers which have low overhead, no
85// ABI or address space layout implications, and only catch undefined behavior.
86SANITIZER_GROUP("undefined", Undefined,
87                Alignment | Bool | ArrayBounds | Enum | FloatCastOverflow |
88                FloatDivideByZero | Function | IntegerDivideByZero | Null |
89                ObjectSize | Return | Shift | SignedIntegerOverflow |
90                Unreachable | VLABound | Vptr)
91
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.
96SANITIZER_GROUP("undefined-trap", UndefinedTrap,
97                Alignment | Bool | ArrayBounds | Enum | FloatCastOverflow |
98                FloatDivideByZero | IntegerDivideByZero | Null | ObjectSize |
99                Return | Shift | SignedIntegerOverflow | Unreachable |
100                VLABound)
101
102SANITIZER_GROUP("integer", Integer,
103                SignedIntegerOverflow | UnsignedIntegerOverflow | Shift |
104                IntegerDivideByZero)
105
106// -fbounds-checking
107SANITIZER("local-bounds", LocalBounds)
108SANITIZER_GROUP("bounds", Bounds, ArrayBounds | LocalBounds)
109
110#undef SANITIZER
111#undef SANITIZER_GROUP
112