[compiler-rt] r298878 - Move lsan allocator cache from lsan_common_linux to lsan_linux

Francis Ricci via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 27 12:42:38 PDT 2017


Author: fjricci
Date: Mon Mar 27 14:42:37 2017
New Revision: 298878

URL: http://llvm.org/viewvc/llvm-project?rev=298878&view=rev
Log:
Move lsan allocator cache from lsan_common_linux to lsan_linux

Having this function in common seems to trigger a lot of unrelated
test failures. Given that this isn't really common code anyway,
move this to a new linux-specific lsan file.

Added:
    compiler-rt/trunk/lib/lsan/lsan_linux.cc
Modified:
    compiler-rt/trunk/lib/lsan/CMakeLists.txt
    compiler-rt/trunk/lib/lsan/lsan_common_linux.cc

Modified: compiler-rt/trunk/lib/lsan/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/CMakeLists.txt?rev=298878&r1=298877&r2=298878&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/lsan/CMakeLists.txt Mon Mar 27 14:42:37 2017
@@ -11,6 +11,7 @@ set(LSAN_COMMON_SOURCES
 set(LSAN_SOURCES
   lsan.cc
   lsan_allocator.cc
+  lsan_linux.cc
   lsan_interceptors.cc
   lsan_preinit.cc
   lsan_thread.cc)

Modified: compiler-rt/trunk/lib/lsan/lsan_common_linux.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lsan_common_linux.cc?rev=298878&r1=298877&r2=298878&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lsan_common_linux.cc (original)
+++ compiler-rt/trunk/lib/lsan/lsan_common_linux.cc Mon Mar 27 14:42:37 2017
@@ -22,7 +22,6 @@
 #include "sanitizer_common/sanitizer_flags.h"
 #include "sanitizer_common/sanitizer_linux.h"
 #include "sanitizer_common/sanitizer_stackdepot.h"
-#include "lsan_allocator.h"
 
 namespace __lsan {
 
@@ -39,9 +38,6 @@ static THREADLOCAL u32 current_thread_ti
 u32 GetCurrentThread() { return current_thread_tid; }
 void SetCurrentThread(u32 tid) { current_thread_tid = tid; }
 
-static THREADLOCAL AllocatorCache allocator_cache;
-AllocatorCache *GetAllocatorCache() { return &allocator_cache; }
-
 __attribute__((tls_model("initial-exec")))
 THREADLOCAL int disable_counter;
 bool DisabledInThisThread() { return disable_counter > 0; }

Added: compiler-rt/trunk/lib/lsan/lsan_linux.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lsan_linux.cc?rev=298878&view=auto
==============================================================================
--- compiler-rt/trunk/lib/lsan/lsan_linux.cc (added)
+++ compiler-rt/trunk/lib/lsan/lsan_linux.cc Mon Mar 27 14:42:37 2017
@@ -0,0 +1,26 @@
+//=-- lsan_linux.cc -------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file is a part of LeakSanitizer. Linux-specific code.
+//
+//===----------------------------------------------------------------------===//
+
+#if SANITIZER_LINUX
+
+#include "lsan_allocator.h"
+
+namespace __lsan {
+
+static THREADLOCAL AllocatorCache allocator_cache;
+AllocatorCache *GetAllocatorCache() { return &allocator_cache; }
+
+} // namespace __lsan
+
+#endif // CAN_SANITIZE_LEAKS && SANITIZER_LINUX
+




More information about the llvm-commits mailing list