summaryrefslogtreecommitdiff
path: root/lib/msan/msan.cc
diff options
context:
space:
mode:
authorAlexey Samsonov <vonosmas@gmail.com>2014-12-19 21:40:04 +0000
committerAlexey Samsonov <vonosmas@gmail.com>2014-12-19 21:40:04 +0000
commit2682c35c75b78d569293e7653359c18a51aac8fa (patch)
tree1a73bd55f4d808dcb2b580efdbd14ba4e0245e5b /lib/msan/msan.cc
parenta7d265546807ffc763cb634fe0c1efaa74955ed9 (diff)
[Sanitizer] Refactor CommonFlags interface. NFC.
Add CommonFlags::SetDefaults() and CommonFlags::ParseFromString(), so that this object can be easily tested. Enforce that ParseCommonFlagsFromString() and SetCommonFlagsDefaults() work only with singleton CommonFlags, shared across all sanitizer runtimes. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224617 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/msan/msan.cc')
-rw-r--r--lib/msan/msan.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/msan/msan.cc b/lib/msan/msan.cc
index 853e448fa..fb1829614 100644
--- a/lib/msan/msan.cc
+++ b/lib/msan/msan.cc
@@ -97,8 +97,6 @@ static uptr StackOriginPC[kNumStackOriginDescrs];
static atomic_uint32_t NumStackOriginDescrs;
static void ParseFlagsFromString(Flags *f, const char *str) {
- CommonFlags *cf = common_flags();
- ParseCommonFlagsFromString(cf, str);
ParseFlag(str, &f->poison_heap_with_zeroes, "poison_heap_with_zeroes", "");
ParseFlag(str, &f->poison_stack_with_zeroes, "poison_stack_with_zeroes", "");
ParseFlag(str, &f->poison_in_malloc, "poison_in_malloc", "");
@@ -147,7 +145,7 @@ static void ParseFlagsFromString(Flags *f, const char *str) {
static void InitializeFlags(Flags *f, const char *options) {
CommonFlags *cf = common_flags();
- SetCommonFlagsDefaults(cf);
+ SetCommonFlagsDefaults();
cf->external_symbolizer_path = GetEnv("MSAN_SYMBOLIZER_PATH");
cf->malloc_context_size = 20;
cf->handle_ioctl = true;
@@ -171,9 +169,13 @@ static void InitializeFlags(Flags *f, const char *options) {
f->store_context_size = 20;
// Override from user-specified string.
- if (__msan_default_options)
+ if (__msan_default_options) {
ParseFlagsFromString(f, __msan_default_options());
+ ParseCommonFlagsFromString(__msan_default_options());
+ }
+
ParseFlagsFromString(f, options);
+ ParseCommonFlagsFromString(options);
}
void GetStackTrace(BufferedStackTrace *stack, uptr max_s, uptr pc, uptr bp,