[PATCH] Introduce -fsanitize-trap= flag.
Alexey Samsonov
vonosmas at gmail.com
Mon Jun 15 18:09:41 PDT 2015
================
Comment at: docs/UsersManual.rst:973
@@ -972,7 +972,3 @@
- - ``-fsanitize=undefined-trap``: This includes all sanitizers
- included by ``-fsanitize=undefined``, except those that require
- runtime support. This group of sanitizers is intended to be
- used in conjunction with the ``-fsanitize-undefined-trap-on-error``
- flag. This includes all of the checks listed below other than
- ``unsigned-integer-overflow`` and ``vptr``.
+ - ``-fsanitize=undefined-trap``: This is an alias for ``-fsanitize=undefined``.
+
----------------
"deprecated alias"
================
Comment at: docs/UsersManual.rst:1096
@@ -1108,1 +1095,3 @@
+**-f[no-]sanitize-trap=check1,check2,...**
+
----------------
Please move it next to `-fsanitize-recover=`.
================
Comment at: docs/UsersManual.rst:1103
@@ +1102,3 @@
+
+ This flag is only compatible with sanitizers in the
+ UndefinedBehaviorSanitizer group other than ``vptr``. If this flag is
----------------
Do you think we should allow other trapping sanitizers (like `local-bounds`) here? Or you plan to do it in subsequent patches?
================
Comment at: include/clang/Driver/Options.td:526
@@ -525,1 +525,3 @@
def fno_sanitize_EQ : CommaJoined<["-"], "fno-sanitize=">, Group<f_clang_Group>;
+def fsanitize_trap_EQ : CommaJoined<["-"], "fsanitize-trap=">, Group<f_clang_Group>,
+ Flags<[CC1Option, CoreOption]>;
----------------
Please move next to fsanitize_recover
================
Comment at: lib/Driver/SanitizerArgs.cpp:37
@@ -36,2 +36,3 @@
NeedsLTO = CFI,
+ TrappingSupported = (Undefined & ~Vptr) | UndefinedGroup,
};
----------------
Could we use smth. like `getSanitizersWithNoRequiredRuntime()` from http://reviews.llvm.org/D10467 instead (if we decide to allow -fsanitize-trap=` for other checks)?
================
Comment at: lib/Driver/SanitizerArgs.cpp:37
@@ -36,2 +36,3 @@
NeedsLTO = CFI,
+ TrappingSupported = (Undefined & ~Vptr) | UndefinedGroup,
};
----------------
samsonov wrote:
> Could we use smth. like `getSanitizersWithNoRequiredRuntime()` from http://reviews.llvm.org/D10467 instead (if we decide to allow -fsanitize-trap=` for other checks)?
I'd prefer to not use `UndefinedGroup` here, and instead add special case for `Vptr` to the loop iterating over `-fsanitize-trap=` arguments. E.g. see how we handle special-case for vptr+RTTI in the main loop in `SanitizerArgs` constructor (not that it's elegant, it's just... more literal).
================
Comment at: lib/Driver/SanitizerArgs.cpp:527
@@ -486,3 +526,3 @@
- if (UbsanTrapOnError)
- CmdArgs.push_back("-fsanitize-undefined-trap-on-error");
+ CmdArgs.push_back(
+ Args.MakeArgString("-fsanitize-trap=" + toString(TrapSanitizers)));
----------------
if (!TrapSanitizers.empty())
http://reviews.llvm.org/D10464
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the cfe-commits
mailing list