r326860 - [Driver] Automatically disable incompatible default sanitizers
Nico Weber via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 6 18:34:22 PST 2018
Test? (Also below)
On Tue, Mar 6, 2018 at 8:27 PM, Petr Hosek via cfe-commits <
cfe-commits at lists.llvm.org> wrote:
> Author: phosek
> Date: Tue Mar 6 17:27:03 2018
> New Revision: 326860
>
> URL: http://llvm.org/viewvc/llvm-project?rev=326860&view=rev
> Log:
> [Driver] Automatically disable incompatible default sanitizers
>
> When a sanitizer incompatible with one of the default sanitizers
> is explicitly enabled, automatically disable all the conflicting
> default sanitizers.
>
> Differential Revision: https://reviews.llvm.org/D44064
>
> Modified:
> cfe/trunk/lib/Driver/SanitizerArgs.cpp
>
> Modified: cfe/trunk/lib/Driver/SanitizerArgs.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/
> SanitizerArgs.cpp?rev=326860&r1=326859&r2=326860&view=diff
> ============================================================
> ==================
> --- cfe/trunk/lib/Driver/SanitizerArgs.cpp (original)
> +++ cfe/trunk/lib/Driver/SanitizerArgs.cpp Tue Mar 6 17:27:03 2018
> @@ -332,8 +332,30 @@ SanitizerArgs::SanitizerArgs(const ToolC
> }
> }
>
> + std::pair<SanitizerMask, SanitizerMask> IncompatibleGroups[] = {
> + std::make_pair(Address, Thread | Memory),
> + std::make_pair(Thread, Memory),
> + std::make_pair(Leak, Thread | Memory),
> + std::make_pair(KernelAddress, Address | Leak | Thread | Memory),
> + std::make_pair(HWAddress, Address | Thread | Memory |
> KernelAddress),
> + std::make_pair(Efficiency, Address | HWAddress | Leak | Thread |
> Memory |
> + KernelAddress),
> + std::make_pair(Scudo, Address | HWAddress | Leak | Thread | Memory |
> + KernelAddress | Efficiency),
> + std::make_pair(SafeStack, Address | HWAddress | Leak | Thread |
> Memory |
> + KernelAddress | Efficiency)};
> +
> // Enable toolchain specific default sanitizers if not explicitly
> disabled.
> - Kinds |= TC.getDefaultSanitizers() & ~AllRemove;
> + SanitizerMask Default = TC.getDefaultSanitizers() & ~AllRemove;
> +
> + // Disable default sanitizers that are incompatible with the default
> ones.
>
You probably mean "Disable default sanitizers that are incompatible with
explicitly requested ones"?
> + for (auto G : IncompatibleGroups) {
> + SanitizerMask Group = G.first;
> + if ((Default & Group) && (Kinds & G.second))
> + Default &= ~Group;
> + }
> +
> + Kinds |= Default;
>
> // We disable the vptr sanitizer if it was enabled by group expansion
> but RTTI
> // is disabled.
> @@ -369,18 +391,6 @@ SanitizerArgs::SanitizerArgs(const ToolC
> }
>
> // Warn about incompatible groups of sanitizers.
> - std::pair<SanitizerMask, SanitizerMask> IncompatibleGroups[] = {
> - std::make_pair(Address, Thread | Memory),
> - std::make_pair(Thread, Memory),
> - std::make_pair(Leak, Thread | Memory),
> - std::make_pair(KernelAddress, Address | Leak | Thread | Memory),
> - std::make_pair(HWAddress, Address | Thread | Memory |
> KernelAddress),
> - std::make_pair(Efficiency, Address | HWAddress | Leak | Thread |
> Memory |
> - KernelAddress),
> - std::make_pair(Scudo, Address | HWAddress | Leak | Thread | Memory |
> - KernelAddress | Efficiency),
> - std::make_pair(SafeStack, Address | HWAddress | Leak | Thread |
> Memory |
> - KernelAddress | Efficiency)};
> for (auto G : IncompatibleGroups) {
> SanitizerMask Group = G.first;
> if (Kinds & Group) {
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180306/8ee9620f/attachment.html>
More information about the cfe-commits
mailing list