]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/clang/include/clang/Basic/Sanitizers.def
Update compiler-rt to trunk r230183. This has some of our patches
[FreeBSD/FreeBSD.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
44 // MemorySanitizer
45 SANITIZER("memory", Memory)
46
47 // ThreadSanitizer
48 SANITIZER("thread", Thread)
49
50 // LeakSanitizer
51 SANITIZER("leak", Leak)
52
53 // UndefinedBehaviorSanitizer
54 SANITIZER("alignment", Alignment)
55 SANITIZER("array-bounds", ArrayBounds)
56 SANITIZER("bool", Bool)
57 SANITIZER("enum", Enum)
58 SANITIZER("float-cast-overflow", FloatCastOverflow)
59 SANITIZER("float-divide-by-zero", FloatDivideByZero)
60 SANITIZER("function", Function)
61 SANITIZER("integer-divide-by-zero", IntegerDivideByZero)
62 SANITIZER("nonnull-attribute", NonnullAttribute)
63 SANITIZER("null", Null)
64 SANITIZER("object-size", ObjectSize)
65 SANITIZER("return", Return)
66 SANITIZER("returns-nonnull-attribute", ReturnsNonnullAttribute)
67 SANITIZER("shift", Shift)
68 SANITIZER("signed-integer-overflow", SignedIntegerOverflow)
69 SANITIZER("unreachable", Unreachable)
70 SANITIZER("vla-bound", VLABound)
71 SANITIZER("vptr", Vptr)
72
73 // IntegerSanitizer
74 SANITIZER("unsigned-integer-overflow", UnsignedIntegerOverflow)
75
76 // DataFlowSanitizer
77 SANITIZER("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.
81 SANITIZER_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.
92 SANITIZER_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
98 SANITIZER_GROUP("integer", Integer,
99                 SignedIntegerOverflow | UnsignedIntegerOverflow | Shift |
100                 IntegerDivideByZero)
101
102 SANITIZER("local-bounds", LocalBounds)
103 SANITIZER_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.
107 SANITIZER_GROUP("all", All, ~0)
108
109 #undef SANITIZER
110 #undef SANITIZER_GROUP