diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2015-06-18 23:59:22 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2015-06-18 23:59:22 +0000 |
commit | e530af8e1dfbc974db9d727cc782f2bbf79bf744 (patch) | |
tree | 7325b9253f6ea0bef1fc0840f62ba4ec99c27625 /include/clang/Basic/Sanitizers.def | |
parent | f5013f013edc47d0a2a11d300536721cc1c060b6 (diff) |
Introduce -fsanitize-trap= flag.
This flag controls whether a given sanitizer traps upon detecting
an error. It currently only supports UBSan. The existing flag
-fsanitize-undefined-trap-on-error has been made an alias of
-fsanitize-trap=undefined.
This change also cleans up some awkward behavior around the combination
of -fsanitize-trap=undefined and -fsanitize=undefined. Previously we
would reject command lines containing the combination of these two flags,
as -fsanitize=vptr is not compatible with trapping. This required the
creation of -fsanitize=undefined-trap, which excluded -fsanitize=vptr
(and -fsanitize=function, but this seems like an oversight).
Now, -fsanitize=undefined is an alias for -fsanitize=undefined-trap,
and if -fsanitize-trap=undefined is specified, we treat -fsanitize=vptr
as an "unsupported" flag, which means that we error out if the flag is
specified explicitly, but implicitly disable it if the flag was implied
by -fsanitize=undefined.
Differential Revision: http://reviews.llvm.org/D10464
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240105 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic/Sanitizers.def')
-rw-r--r-- | include/clang/Basic/Sanitizers.def | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/include/clang/Basic/Sanitizers.def b/include/clang/Basic/Sanitizers.def index c50f3e14f5..9e341ae55d 100644 --- a/include/clang/Basic/Sanitizers.def +++ b/include/clang/Basic/Sanitizers.def @@ -90,18 +90,17 @@ SANITIZER_GROUP("cfi", CFI, // Safe Stack SANITIZER("safe-stack", SafeStack) -// -fsanitize=undefined-trap includes sanitizers from -fsanitize=undefined -// that can be used without runtime support, generally by providing extra -// -fsanitize-undefined-trap-on-error flag. -SANITIZER_GROUP("undefined-trap", UndefinedTrap, +// -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 | ArrayBounds | Enum | FloatCastOverflow | FloatDivideByZero | IntegerDivideByZero | NonnullAttribute | Null | ObjectSize | Return | ReturnsNonnullAttribute | - Shift | SignedIntegerOverflow | Unreachable | VLABound) + Shift | SignedIntegerOverflow | Unreachable | VLABound | + Function | Vptr) -// -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, UndefinedTrap | Function | Vptr) +// -fsanitize=undefined-trap is an alias for -fsanitize=undefined. +SANITIZER_GROUP("undefined-trap", UndefinedTrap, Undefined) SANITIZER_GROUP("integer", Integer, SignedIntegerOverflow | UnsignedIntegerOverflow | Shift | |