Index: compiler-rt/trunk/lib/asan/asan_activation.cc =================================================================== --- compiler-rt/trunk/lib/asan/asan_activation.cc +++ compiler-rt/trunk/lib/asan/asan_activation.cc @@ -61,7 +61,7 @@ parser.ParseString(env); } - SetVerbosity(cf.verbosity); + InitializeCommonFlags(&cf); if (Verbosity()) ReportUnrecognizedFlags(); Index: compiler-rt/trunk/lib/asan/asan_flags.cc =================================================================== --- compiler-rt/trunk/lib/asan/asan_flags.cc +++ compiler-rt/trunk/lib/asan/asan_flags.cc @@ -116,7 +116,7 @@ ubsan_parser.ParseString(GetEnv("UBSAN_OPTIONS")); #endif - SetVerbosity(common_flags()->verbosity); + InitializeCommonFlags(); // TODO(eugenis): dump all flags at verbosity>=2? if (Verbosity()) ReportUnrecognizedFlags(); Index: compiler-rt/trunk/lib/cfi/cfi.cc =================================================================== --- compiler-rt/trunk/lib/cfi/cfi.cc +++ compiler-rt/trunk/lib/cfi/cfi.cc @@ -343,7 +343,7 @@ ubsan_parser.ParseString(GetEnv("UBSAN_OPTIONS")); #endif - SetVerbosity(common_flags()->verbosity); + InitializeCommonFlags(); if (Verbosity()) ReportUnrecognizedFlags(); Index: compiler-rt/trunk/lib/dfsan/dfsan.cc =================================================================== --- compiler-rt/trunk/lib/dfsan/dfsan.cc +++ compiler-rt/trunk/lib/dfsan/dfsan.cc @@ -362,7 +362,7 @@ RegisterCommonFlags(&parser); RegisterDfsanFlags(&parser, &flags()); parser.ParseString(GetEnv("DFSAN_OPTIONS")); - SetVerbosity(common_flags()->verbosity); + InitializeCommonFlags(); if (Verbosity()) ReportUnrecognizedFlags(); if (common_flags()->help) parser.PrintFlagDescriptions(); } Index: compiler-rt/trunk/lib/msan/msan.cc =================================================================== --- compiler-rt/trunk/lib/msan/msan.cc +++ compiler-rt/trunk/lib/msan/msan.cc @@ -178,7 +178,7 @@ #endif VPrintf(1, "MSAN_OPTIONS: %s\n", msan_options ? msan_options : ""); - SetVerbosity(common_flags()->verbosity); + InitializeCommonFlags(); if (Verbosity()) ReportUnrecognizedFlags(); Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.h =================================================================== --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.h +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.h @@ -52,6 +52,11 @@ void RegisterCommonFlags(FlagParser *parser, CommonFlags *cf = &common_flags_dont_use); void RegisterIncludeFlags(FlagParser *parser, CommonFlags *cf); + +// Should be called after parsing all flags. Sets up common flag values +// and perform initializations common to all sanitizers (e.g. setting +// verbosity). +void InitializeCommonFlags(CommonFlags *cf = &common_flags_dont_use); } // namespace __sanitizer #endif // SANITIZER_FLAGS_H Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.cc =================================================================== --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.cc +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.cc @@ -126,4 +126,10 @@ RegisterIncludeFlags(parser, cf); } +void InitializeCommonFlags(CommonFlags *cf) { + // need to record coverage to generate coverage report. + cf->coverage |= cf->html_cov_report; + SetVerbosity(cf->verbosity); +} + } // namespace __sanitizer Index: compiler-rt/trunk/lib/tsan/rtl/tsan_flags.cc =================================================================== --- compiler-rt/trunk/lib/tsan/rtl/tsan_flags.cc +++ compiler-rt/trunk/lib/tsan/rtl/tsan_flags.cc @@ -108,7 +108,7 @@ f->report_signal_unsafe = false; } - SetVerbosity(common_flags()->verbosity); + InitializeCommonFlags(); if (Verbosity()) ReportUnrecognizedFlags(); Index: compiler-rt/trunk/lib/ubsan/ubsan_flags.cc =================================================================== --- compiler-rt/trunk/lib/ubsan/ubsan_flags.cc +++ compiler-rt/trunk/lib/ubsan/ubsan_flags.cc @@ -59,7 +59,7 @@ parser.ParseString(MaybeCallUbsanDefaultOptions()); // Override from environment variable. parser.ParseString(GetEnv("UBSAN_OPTIONS")); - SetVerbosity(common_flags()->verbosity); + InitializeCommonFlags(); if (Verbosity()) ReportUnrecognizedFlags(); if (common_flags()->help) parser.PrintFlagDescriptions();