[sancov] common flags initialization.

Summary:
Introducing InitializeCommonFlags accross all sanitizers to simplify
common flags management.

Setting coverage=1 when html_cov_report is requested.

Differential Revision: http://reviews.llvm.org/D18273

llvm-svn: 263820
This commit is contained in:
Mike Aizatsky 2016-03-18 19:28:07 +00:00
parent cdfd7e7201
commit 6d8a876159
9 changed files with 18 additions and 7 deletions

View File

@ -61,7 +61,7 @@ static struct AsanDeactivatedFlags {
parser.ParseString(env);
}
SetVerbosity(cf.verbosity);
InitializeCommonFlags(&cf);
if (Verbosity()) ReportUnrecognizedFlags();

View File

@ -116,7 +116,7 @@ void InitializeFlags() {
ubsan_parser.ParseString(GetEnv("UBSAN_OPTIONS"));
#endif
SetVerbosity(common_flags()->verbosity);
InitializeCommonFlags();
// TODO(eugenis): dump all flags at verbosity>=2?
if (Verbosity()) ReportUnrecognizedFlags();

View File

@ -343,7 +343,7 @@ void InitializeFlags() {
ubsan_parser.ParseString(GetEnv("UBSAN_OPTIONS"));
#endif
SetVerbosity(common_flags()->verbosity);
InitializeCommonFlags();
if (Verbosity())
ReportUnrecognizedFlags();

View File

@ -362,7 +362,7 @@ static void InitializeFlags() {
RegisterCommonFlags(&parser);
RegisterDfsanFlags(&parser, &flags());
parser.ParseString(GetEnv("DFSAN_OPTIONS"));
SetVerbosity(common_flags()->verbosity);
InitializeCommonFlags();
if (Verbosity()) ReportUnrecognizedFlags();
if (common_flags()->help) parser.PrintFlagDescriptions();
}

View File

@ -178,7 +178,7 @@ static void InitializeFlags() {
#endif
VPrintf(1, "MSAN_OPTIONS: %s\n", msan_options ? msan_options : "<empty>");
SetVerbosity(common_flags()->verbosity);
InitializeCommonFlags();
if (Verbosity()) ReportUnrecognizedFlags();

View File

@ -126,4 +126,10 @@ void RegisterCommonFlags(FlagParser *parser, CommonFlags *cf) {
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

View File

@ -52,6 +52,11 @@ class FlagParser;
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

View File

@ -108,7 +108,7 @@ void InitializeFlags(Flags *f, const char *env) {
f->report_signal_unsafe = false;
}
SetVerbosity(common_flags()->verbosity);
InitializeCommonFlags();
if (Verbosity()) ReportUnrecognizedFlags();

View File

@ -59,7 +59,7 @@ void InitializeFlags() {
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();