Sanitizers.def revision 261991
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)
43249423Sdim// More features of AddressSanitizer that should be turned on explicitly.
44249423SdimSANITIZER("init-order", InitOrder)
45249423SdimSANITIZER("use-after-return", UseAfterReturn)
46249423SdimSANITIZER("use-after-scope", UseAfterScope)
47243791Sdim
48249423SdimSANITIZER_GROUP("address-full", AddressFull,
49249423Sdim                Address | InitOrder | UseAfterReturn | UseAfterScope)
50249423Sdim
51249423Sdim// MemorySanitizer
52249423SdimSANITIZER("memory", Memory)
53249423Sdim
54243791Sdim// ThreadSanitizer
55243791SdimSANITIZER("thread", Thread)
56243791Sdim
57261991Sdim// LeakSanitizer
58261991SdimSANITIZER("leak", Leak)
59261991Sdim
60243791Sdim// UndefinedBehaviorSanitizer
61249423SdimSANITIZER("alignment", Alignment)
62261991SdimSANITIZER("array-bounds", ArrayBounds)
63249423SdimSANITIZER("bool", Bool)
64249423SdimSANITIZER("enum", Enum)
65249423SdimSANITIZER("float-cast-overflow", FloatCastOverflow)
66249423SdimSANITIZER("float-divide-by-zero", FloatDivideByZero)
67261991SdimSANITIZER("function", Function)
68249423SdimSANITIZER("integer-divide-by-zero", IntegerDivideByZero)
69249423SdimSANITIZER("null", Null)
70249423SdimSANITIZER("object-size", ObjectSize)
71249423SdimSANITIZER("return", Return)
72249423SdimSANITIZER("shift", Shift)
73243791SdimSANITIZER("signed-integer-overflow", SignedIntegerOverflow)
74243791SdimSANITIZER("unreachable", Unreachable)
75243791SdimSANITIZER("vla-bound", VLABound)
76243791SdimSANITIZER("vptr", Vptr)
77243791Sdim
78249423Sdim// IntegerSanitizer
79249423SdimSANITIZER("unsigned-integer-overflow", UnsignedIntegerOverflow)
80249423Sdim
81261991Sdim// DataFlowSanitizer
82261991SdimSANITIZER("dataflow", DataFlow)
83261991Sdim
84249423Sdim// -fsanitize=undefined includes all the sanitizers which have low overhead, no
85249423Sdim// ABI or address space layout implications, and only catch undefined behavior.
86243791SdimSANITIZER_GROUP("undefined", Undefined,
87261991Sdim                Alignment | Bool | ArrayBounds | Enum | FloatCastOverflow |
88261991Sdim                FloatDivideByZero | Function | IntegerDivideByZero | Null |
89261991Sdim                ObjectSize | Return | Shift | SignedIntegerOverflow |
90261991Sdim                Unreachable | VLABound | Vptr)
91243791Sdim
92249423Sdim// -fsanitize=undefined-trap (and its alias -fcatch-undefined-behavior) includes
93249423Sdim// all sanitizers included by -fsanitize=undefined, except those that require
94249423Sdim// runtime support.  This group is generally used in conjunction with the
95249423Sdim// -fsanitize-undefined-trap-on-error flag.
96249423SdimSANITIZER_GROUP("undefined-trap", UndefinedTrap,
97261991Sdim                Alignment | Bool | ArrayBounds | Enum | FloatCastOverflow |
98249423Sdim                FloatDivideByZero | IntegerDivideByZero | Null | ObjectSize |
99249423Sdim                Return | Shift | SignedIntegerOverflow | Unreachable |
100249423Sdim                VLABound)
101249423Sdim
102249423SdimSANITIZER_GROUP("integer", Integer,
103249423Sdim                SignedIntegerOverflow | UnsignedIntegerOverflow | Shift |
104249423Sdim                IntegerDivideByZero)
105249423Sdim
106261991Sdim// -fbounds-checking
107261991SdimSANITIZER("local-bounds", LocalBounds)
108261991SdimSANITIZER_GROUP("bounds", Bounds, ArrayBounds | LocalBounds)
109261991Sdim
110243791Sdim#undef SANITIZER
111243791Sdim#undef SANITIZER_GROUP
112