//===--- Sanitizers.def - Runtime sanitizer options -------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file defines the options for specifying which runtime sanitizers to
// enable. Users of this file must define the SANITIZER macro to make use of
// this information. Users of this file can also define the SANITIZER_GROUP
// macro to get information on options which refer to sets of sanitizers.
//
//===----------------------------------------------------------------------===//

#ifndef SANITIZER
#error "Define SANITIZER prior to including this file!"
#endif

// SANITIZER(NAME, ID)

// The first value is the name of the sanitizer as a string. The sanitizer can
// be enabled by specifying -fsanitize=NAME.

// The second value is an identifier which can be used to refer to the
// sanitizer.


// SANITIZER_GROUP(NAME, ID, ALIAS)

// The first two values have the same semantics as the corresponding SANITIZER
// values. The third value is an expression ORing together the IDs of individual
// sanitizers in this group.

#ifndef SANITIZER_GROUP
#define SANITIZER_GROUP(NAME, ID, ALIAS)
#endif


// AddressSanitizer
SANITIZER("address", Address)
// More features of AddressSanitizer that should be turned on explicitly.
SANITIZER("init-order", InitOrder)
SANITIZER("use-after-return", UseAfterReturn)
SANITIZER("use-after-scope", UseAfterScope)

SANITIZER_GROUP("address-full", AddressFull,
                Address | InitOrder | UseAfterReturn | UseAfterScope)

// MemorySanitizer
SANITIZER("memory", Memory)

// ThreadSanitizer
SANITIZER("thread", Thread)

// UndefinedBehaviorSanitizer
SANITIZER("alignment", Alignment)
SANITIZER("bool", Bool)
SANITIZER("bounds", Bounds)
SANITIZER("enum", Enum)
SANITIZER("float-cast-overflow", FloatCastOverflow)
SANITIZER("float-divide-by-zero", FloatDivideByZero)
SANITIZER("integer-divide-by-zero", IntegerDivideByZero)
SANITIZER("null", Null)
SANITIZER("object-size", ObjectSize)
SANITIZER("return", Return)
SANITIZER("shift", Shift)
SANITIZER("signed-integer-overflow", SignedIntegerOverflow)
SANITIZER("unreachable", Unreachable)
SANITIZER("vla-bound", VLABound)
SANITIZER("vptr", Vptr)

// IntegerSanitizer
SANITIZER("unsigned-integer-overflow", UnsignedIntegerOverflow)

// -fsanitize=undefined includes all the sanitizers which have low overhead, no
// ABI or address space layout implications, and only catch undefined behavior.
SANITIZER_GROUP("undefined", Undefined,
                Alignment | Bool | Bounds | Enum | FloatCastOverflow |
                FloatDivideByZero | IntegerDivideByZero | Null | ObjectSize |
                Return | Shift | SignedIntegerOverflow | Unreachable |
                VLABound | Vptr)

// -fsanitize=undefined-trap (and its alias -fcatch-undefined-behavior) includes
// all sanitizers included by -fsanitize=undefined, except those that require
// runtime support.  This group is generally used in conjunction with the
// -fsanitize-undefined-trap-on-error flag.
SANITIZER_GROUP("undefined-trap", UndefinedTrap,
                Alignment | Bool | Bounds | Enum | FloatCastOverflow |
                FloatDivideByZero | IntegerDivideByZero | Null | ObjectSize |
                Return | Shift | SignedIntegerOverflow | Unreachable |
                VLABound)

SANITIZER_GROUP("integer", Integer,
                SignedIntegerOverflow | UnsignedIntegerOverflow | Shift |
                IntegerDivideByZero)

#undef SANITIZER
#undef SANITIZER_GROUP
