]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - contrib/llvm/tools/clang/include/clang/Basic/Sanitizers.def
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.git] / contrib / llvm / tools / clang / include / clang / Basic / Sanitizers.def
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
42 SANITIZER("address", Address)
43 // More features of AddressSanitizer that should be turned on explicitly.
44 SANITIZER("init-order", InitOrder)
45 SANITIZER("use-after-return", UseAfterReturn)
46 SANITIZER("use-after-scope", UseAfterScope)
47
48 SANITIZER_GROUP("address-full", AddressFull,
49                 Address | InitOrder | UseAfterReturn | UseAfterScope)
50
51 // MemorySanitizer
52 SANITIZER("memory", Memory)
53
54 // ThreadSanitizer
55 SANITIZER("thread", Thread)
56
57 // LeakSanitizer
58 SANITIZER("leak", Leak)
59
60 // UndefinedBehaviorSanitizer
61 SANITIZER("alignment", Alignment)
62 SANITIZER("array-bounds", ArrayBounds)
63 SANITIZER("bool", Bool)
64 SANITIZER("enum", Enum)
65 SANITIZER("float-cast-overflow", FloatCastOverflow)
66 SANITIZER("float-divide-by-zero", FloatDivideByZero)
67 SANITIZER("function", Function)
68 SANITIZER("integer-divide-by-zero", IntegerDivideByZero)
69 SANITIZER("null", Null)
70 SANITIZER("object-size", ObjectSize)
71 SANITIZER("return", Return)
72 SANITIZER("shift", Shift)
73 SANITIZER("signed-integer-overflow", SignedIntegerOverflow)
74 SANITIZER("unreachable", Unreachable)
75 SANITIZER("vla-bound", VLABound)
76 SANITIZER("vptr", Vptr)
77
78 // IntegerSanitizer
79 SANITIZER("unsigned-integer-overflow", UnsignedIntegerOverflow)
80
81 // DataFlowSanitizer
82 SANITIZER("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.
86 SANITIZER_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.
96 SANITIZER_GROUP("undefined-trap", UndefinedTrap,
97                 Alignment | Bool | ArrayBounds | Enum | FloatCastOverflow |
98                 FloatDivideByZero | IntegerDivideByZero | Null | ObjectSize |
99                 Return | Shift | SignedIntegerOverflow | Unreachable |
100                 VLABound)
101
102 SANITIZER_GROUP("integer", Integer,
103                 SignedIntegerOverflow | UnsignedIntegerOverflow | Shift |
104                 IntegerDivideByZero)
105
106 // -fbounds-checking
107 SANITIZER("local-bounds", LocalBounds)
108 SANITIZER_GROUP("bounds", Bounds, ArrayBounds | LocalBounds)
109
110 #undef SANITIZER
111 #undef SANITIZER_GROUP