forked from OSchip/llvm-project
[Sanitizer] Change InitializeFlags() signatures. NFC.
These functions are always used to initialize singleton flags(), as well as other global data (common_flags()). llvm-svn: 228894
This commit is contained in:
parent
c9b0ea6eec
commit
1225816a2d
|
@ -46,14 +46,15 @@ void Flags::SetDefaults() {
|
|||
#undef ASAN_FLAG
|
||||
}
|
||||
|
||||
void RegisterAsanFlags(FlagParser *parser, Flags *f) {
|
||||
static void RegisterAsanFlags(FlagParser *parser, Flags *f) {
|
||||
#define ASAN_FLAG(Type, Name, DefaultValue, Description) \
|
||||
RegisterFlag(parser, #Name, Description, &f->Name);
|
||||
#include "asan_flags.inc"
|
||||
#undef ASAN_FLAG
|
||||
}
|
||||
|
||||
void InitializeFlags(Flags *f) {
|
||||
void InitializeFlags() {
|
||||
Flags *f = flags();
|
||||
FlagParser parser;
|
||||
RegisterAsanFlags(&parser, f);
|
||||
RegisterCommonFlags(&parser);
|
||||
|
|
|
@ -41,8 +41,8 @@ extern Flags asan_flags_dont_use_directly;
|
|||
inline Flags *flags() {
|
||||
return &asan_flags_dont_use_directly;
|
||||
}
|
||||
void RegisterAsanFlags(FlagParser *parser, Flags *f);
|
||||
void InitializeFlags(Flags *f);
|
||||
|
||||
void InitializeFlags();
|
||||
|
||||
} // namespace __asan
|
||||
|
||||
|
|
|
@ -314,7 +314,7 @@ static void AsanInitInternal() {
|
|||
|
||||
// Initialize flags. This must be done early, because most of the
|
||||
// initialization steps look at flags().
|
||||
InitializeFlags(flags());
|
||||
InitializeFlags();
|
||||
|
||||
SetCanPoisonMemory(flags()->poison_heap);
|
||||
SetMallocContextSize(common_flags()->malloc_context_size);
|
||||
|
|
|
@ -317,18 +317,18 @@ void Flags::SetDefaults() {
|
|||
#undef DFSAN_FLAG
|
||||
}
|
||||
|
||||
void RegisterDfsanFlags(FlagParser *parser, Flags *f) {
|
||||
static void RegisterDfsanFlags(FlagParser *parser, Flags *f) {
|
||||
#define DFSAN_FLAG(Type, Name, DefaultValue, Description) \
|
||||
RegisterFlag(parser, #Name, Description, &f->Name);
|
||||
#include "dfsan_flags.inc"
|
||||
#undef DFSAN_FLAG
|
||||
}
|
||||
|
||||
static void InitializeFlags(Flags &f, const char *env) {
|
||||
static void InitializeFlags() {
|
||||
FlagParser parser;
|
||||
RegisterDfsanFlags(&parser, &f);
|
||||
f.SetDefaults();
|
||||
parser.ParseString(env);
|
||||
RegisterDfsanFlags(&parser, &flags());
|
||||
flags().SetDefaults();
|
||||
parser.ParseString(GetEnv("DFSAN_OPTIONS"));
|
||||
}
|
||||
|
||||
static void dfsan_fini() {
|
||||
|
@ -363,8 +363,7 @@ static void dfsan_init(int argc, char **argv, char **envp) {
|
|||
if (!(init_addr >= kUnusedAddr && init_addr < kAppAddr))
|
||||
Mprotect(kUnusedAddr, kAppAddr - kUnusedAddr);
|
||||
|
||||
InitializeFlags(flags(), GetEnv("DFSAN_OPTIONS"));
|
||||
|
||||
InitializeFlags();
|
||||
InitializeInterceptors();
|
||||
|
||||
// Register the fini callback to run when the program terminates successfully
|
||||
|
|
|
@ -120,7 +120,7 @@ class FlagHandlerKeepGoing : public FlagHandlerBase {
|
|||
}
|
||||
};
|
||||
|
||||
void RegisterMsanFlags(FlagParser *parser, Flags *f) {
|
||||
static void RegisterMsanFlags(FlagParser *parser, Flags *f) {
|
||||
#define MSAN_FLAG(Type, Name, DefaultValue, Description) \
|
||||
RegisterFlag(parser, #Name, Description, &f->Name);
|
||||
#include "msan_flags.inc"
|
||||
|
@ -132,7 +132,8 @@ void RegisterMsanFlags(FlagParser *parser, Flags *f) {
|
|||
"deprecated, use halt_on_error");
|
||||
}
|
||||
|
||||
static void InitializeFlags(Flags *f, const char *options) {
|
||||
static void InitializeFlags() {
|
||||
Flags *f = flags();
|
||||
FlagParser parser;
|
||||
RegisterMsanFlags(&parser, f);
|
||||
RegisterCommonFlags(&parser);
|
||||
|
@ -156,7 +157,9 @@ static void InitializeFlags(Flags *f, const char *options) {
|
|||
if (__msan_default_options)
|
||||
parser.ParseString(__msan_default_options());
|
||||
|
||||
parser.ParseString(options);
|
||||
const char *msan_options = GetEnv("MSAN_OPTIONS");
|
||||
parser.ParseString(msan_options);
|
||||
VPrintf(1, "MSAN_OPTIONS: %s\n", msan_options ? msan_options : "<empty>");
|
||||
|
||||
SetVerbosity(common_flags()->verbosity);
|
||||
|
||||
|
@ -351,8 +354,7 @@ void __msan_init() {
|
|||
SetDieCallback(MsanDie);
|
||||
InitTlsSize();
|
||||
|
||||
const char *msan_options = GetEnv("MSAN_OPTIONS");
|
||||
InitializeFlags(&msan_flags, msan_options);
|
||||
InitializeFlags();
|
||||
__sanitizer_set_report_path(common_flags()->log_path);
|
||||
|
||||
InitializeInterceptors();
|
||||
|
@ -369,8 +371,6 @@ void __msan_init() {
|
|||
ReExec();
|
||||
}
|
||||
|
||||
VPrintf(1, "MSAN_OPTIONS: %s\n", msan_options ? msan_options : "<empty>");
|
||||
|
||||
__msan_clear_on_return();
|
||||
if (__msan_get_track_origins())
|
||||
VPrintf(1, "msan_track_origins\n");
|
||||
|
|
|
@ -65,8 +65,8 @@ u32 Callback::Unwind() {
|
|||
return CurrentStackTrace(thr, 3);
|
||||
}
|
||||
|
||||
void InitializeFlags(Flags *f, const char *env) {
|
||||
internal_memset(f, 0, sizeof(*f));
|
||||
static void InitializeFlags() {
|
||||
Flags *f = flags();
|
||||
|
||||
// Default values.
|
||||
f->second_deadlock_stack = false;
|
||||
|
@ -84,7 +84,7 @@ void InitializeFlags(Flags *f, const char *env) {
|
|||
FlagParser parser;
|
||||
RegisterFlag(&parser, "second_deadlock_stack", "", &f->second_deadlock_stack);
|
||||
RegisterCommonFlags(&parser);
|
||||
parser.ParseString(env);
|
||||
parser.ParseString(GetEnv("DSAN_OPTIONS"));
|
||||
SetVerbosity(common_flags()->verbosity);
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ void Initialize() {
|
|||
ctx = new(ctx_mem) Context();
|
||||
|
||||
InitializeInterceptors();
|
||||
InitializeFlags(flags(), GetEnv("DSAN_OPTIONS"));
|
||||
InitializeFlags();
|
||||
ctx->dd = DDetector::Create(flags());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue