[compiler-rt] r228894 - [Sanitizer] Change InitializeFlags() signatures. NFC.
Alexey Samsonov
vonosmas at gmail.com
Wed Feb 11 16:36:42 PST 2015
Author: samsonov
Date: Wed Feb 11 18:36:42 2015
New Revision: 228894
URL: http://llvm.org/viewvc/llvm-project?rev=228894&view=rev
Log:
[Sanitizer] Change InitializeFlags() signatures. NFC.
These functions are always used to initialize singleton flags(), as
well as other global data (common_flags()).
Modified:
compiler-rt/trunk/lib/asan/asan_flags.cc
compiler-rt/trunk/lib/asan/asan_flags.h
compiler-rt/trunk/lib/asan/asan_rtl.cc
compiler-rt/trunk/lib/dfsan/dfsan.cc
compiler-rt/trunk/lib/msan/msan.cc
compiler-rt/trunk/lib/tsan/dd/dd_rtl.cc
Modified: compiler-rt/trunk/lib/asan/asan_flags.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_flags.cc?rev=228894&r1=228893&r2=228894&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_flags.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_flags.cc Wed Feb 11 18:36:42 2015
@@ -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);
Modified: compiler-rt/trunk/lib/asan/asan_flags.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_flags.h?rev=228894&r1=228893&r2=228894&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_flags.h (original)
+++ compiler-rt/trunk/lib/asan/asan_flags.h Wed Feb 11 18:36:42 2015
@@ -41,8 +41,8 @@ extern Flags asan_flags_dont_use_directl
inline Flags *flags() {
return &asan_flags_dont_use_directly;
}
-void RegisterAsanFlags(FlagParser *parser, Flags *f);
-void InitializeFlags(Flags *f);
+
+void InitializeFlags();
} // namespace __asan
Modified: compiler-rt/trunk/lib/asan/asan_rtl.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_rtl.cc?rev=228894&r1=228893&r2=228894&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_rtl.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_rtl.cc Wed Feb 11 18:36:42 2015
@@ -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);
Modified: compiler-rt/trunk/lib/dfsan/dfsan.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/dfsan/dfsan.cc?rev=228894&r1=228893&r2=228894&view=diff
==============================================================================
--- compiler-rt/trunk/lib/dfsan/dfsan.cc (original)
+++ compiler-rt/trunk/lib/dfsan/dfsan.cc Wed Feb 11 18:36:42 2015
@@ -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 **
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
Modified: compiler-rt/trunk/lib/msan/msan.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/msan.cc?rev=228894&r1=228893&r2=228894&view=diff
==============================================================================
--- compiler-rt/trunk/lib/msan/msan.cc (original)
+++ compiler-rt/trunk/lib/msan/msan.cc Wed Feb 11 18:36:42 2015
@@ -120,7 +120,7 @@ class FlagHandlerKeepGoing : public Flag
}
};
-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 *parse
"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, co
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");
Modified: compiler-rt/trunk/lib/tsan/dd/dd_rtl.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/dd/dd_rtl.cc?rev=228894&r1=228893&r2=228894&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/dd/dd_rtl.cc (original)
+++ compiler-rt/trunk/lib/tsan/dd/dd_rtl.cc Wed Feb 11 18:36:42 2015
@@ -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 cha
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());
}
More information about the llvm-commits
mailing list