From 2682c35c75b78d569293e7653359c18a51aac8fa Mon Sep 17 00:00:00 2001 From: Alexey Samsonov Date: Fri, 19 Dec 2014 21:40:04 +0000 Subject: [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 --- lib/msan/msan.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'lib/msan/msan.cc') 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, -- cgit v1.2.3