[compiler-rt] r197014 - [TSan] Replace __tsan::OverrideFlags with __tsan::OnInitialize

Alexey Samsonov samsonov at google.com
Tue Dec 10 23:31:36 PST 2013


Author: samsonov
Date: Wed Dec 11 01:31:36 2013
New Revision: 197014

URL: http://llvm.org/viewvc/llvm-project?rev=197014&view=rev
Log:
[TSan] Replace __tsan::OverrideFlags with __tsan::OnInitialize

Modified:
    compiler-rt/trunk/lib/tsan/rtl/tsan_flags.cc
    compiler-rt/trunk/lib/tsan/rtl/tsan_flags.h
    compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.cc

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_flags.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_flags.cc?rev=197014&r1=197013&r2=197014&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_flags.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_flags.cc Wed Dec 11 01:31:36 2013
@@ -25,12 +25,8 @@ Flags *flags() {
 
 // Can be overriden in frontend.
 #ifdef TSAN_EXTERNAL_HOOKS
-void OverrideFlags(Flags *f);
 extern "C" const char* __tsan_default_options();
 #else
-void WEAK OverrideFlags(Flags *f) {
-  (void)f;
-}
 extern "C" const char *WEAK __tsan_default_options() {
   return "";
 }
@@ -95,7 +91,6 @@ void InitializeFlags(Flags *f, const cha
   SetCommonFlagsDefaults(f);
 
   // Let a frontend override.
-  OverrideFlags(f);
   ParseFlags(f, __tsan_default_options());
   ParseCommonFlagsFromString(f, __tsan_default_options());
   // Override from command line.

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_flags.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_flags.h?rev=197014&r1=197013&r2=197014&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_flags.h (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_flags.h Wed Dec 11 01:31:36 2013
@@ -14,12 +14,6 @@
 #ifndef TSAN_FLAGS_H
 #define TSAN_FLAGS_H
 
-// ----------- ATTENTION -------------
-// ThreadSanitizer user may provide its implementation of weak
-// symbol __tsan::OverrideFlags(__tsan::Flags). Therefore, this
-// header may be included in the user code, and shouldn't include
-// other headers from TSan or common sanitizer runtime.
-
 #include "sanitizer_common/sanitizer_flags.h"
 
 namespace __tsan {

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.cc?rev=197014&r1=197013&r2=197014&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.cc Wed Dec 11 01:31:36 2013
@@ -41,10 +41,12 @@ static char ctx_placeholder[sizeof(Conte
 // Can be overriden by a front-end.
 #ifdef TSAN_EXTERNAL_HOOKS
 bool OnFinalize(bool failed);
+void OnInitialize();
 #else
 bool WEAK OnFinalize(bool failed) {
   return failed;
 }
+void WEAK OnInitialize() {}
 #endif
 
 static Context *ctx;
@@ -231,6 +233,7 @@ void Initialize(ThreadState *thr) {
   InitializeShadowMemory();
 #endif
   InitializeFlags(&ctx->flags, env);
+  OnInitialize();
   // Setup correct file descriptor for error reports.
   __sanitizer_set_report_path(flags()->log_path);
   InitializeSuppressions();





More information about the llvm-commits mailing list