[GWP-ASan] Respect GWP_ASAN_DEFAULT_ENABLED compile-time macro

If the containing allocator build uses -DGWP_ASAN_DEFAULT_ENABLED=false
then the option will default to false.  For e.g. Scudo, this is simpler
and more efficient than using -DSCUDO_DEFAULT_OPTIONS=... to set gwp-asan
options that have to be parsed from the string at startup.

Reviewed By: hctim

Differential Revision: https://reviews.llvm.org/D91463
This commit is contained in:
Roland McGrath 2020-11-18 09:29:30 -08:00
parent adf9f64a02
commit 7810d83786
1 changed files with 12 additions and 1 deletions

View File

@ -10,7 +10,18 @@
#error "Define GWP_ASAN_OPTION prior to including this file!"
#endif
GWP_ASAN_OPTION(bool, Enabled, true, "Is GWP-ASan enabled? Defaults to true.")
#ifndef GWP_ASAN_DEFAULT_ENABLED
#define GWP_ASAN_DEFAULT_ENABLED true
#endif
#ifndef GWP_ASAN_STRINGIFY
#define GWP_ASAN_STRINGIFY(S) GWP_ASAN_STRINGIFY_(S)
#define GWP_ASAN_STRINGIFY_(S) #S
#endif
GWP_ASAN_OPTION(bool, Enabled, GWP_ASAN_DEFAULT_ENABLED,
"Is GWP-ASan enabled? Defaults to " GWP_ASAN_STRINGIFY(
GWP_ASAN_DEFAULT_ENABLED) ".")
GWP_ASAN_OPTION(
bool, PerfectlyRightAlign, false,