• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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("null", Null)
63SANITIZER("object-size", ObjectSize)
64SANITIZER("return", Return)
65SANITIZER("shift", Shift)
66SANITIZER("signed-integer-overflow", SignedIntegerOverflow)
67SANITIZER("unreachable", Unreachable)
68SANITIZER("vla-bound", VLABound)
69SANITIZER("vptr", Vptr)
70
71// IntegerSanitizer
72SANITIZER("unsigned-integer-overflow", UnsignedIntegerOverflow)
73
74// DataFlowSanitizer
75SANITIZER("dataflow", DataFlow)
76
77// -fsanitize=undefined includes all the sanitizers which have low overhead, no
78// ABI or address space layout implications, and only catch undefined behavior.
79SANITIZER_GROUP("undefined", Undefined,
80                Alignment | Bool | ArrayBounds | Enum | FloatCastOverflow |
81                FloatDivideByZero | Function | IntegerDivideByZero | Null |
82                ObjectSize | Return | Shift | SignedIntegerOverflow |
83                Unreachable | VLABound | Vptr)
84
85// -fsanitize=undefined-trap includes
86// all sanitizers included by -fsanitize=undefined, except those that require
87// runtime support.  This group is generally used in conjunction with the
88// -fsanitize-undefined-trap-on-error flag.
89SANITIZER_GROUP("undefined-trap", UndefinedTrap,
90                Alignment | Bool | ArrayBounds | Enum | FloatCastOverflow |
91                FloatDivideByZero | IntegerDivideByZero | Null | ObjectSize |
92                Return | Shift | SignedIntegerOverflow | Unreachable |
93                VLABound)
94
95SANITIZER_GROUP("integer", Integer,
96                SignedIntegerOverflow | UnsignedIntegerOverflow | Shift |
97                IntegerDivideByZero)
98
99SANITIZER("local-bounds", LocalBounds)
100SANITIZER_GROUP("bounds", Bounds, ArrayBounds | LocalBounds)
101
102#undef SANITIZER
103#undef SANITIZER_GROUP
104