[compiler-rt] r184557 - [lsan] Try REALLY hard to fix Win build.

Sergey Matveev earthdok at google.com
Fri Jun 21 08:50:50 PDT 2013


Author: smatveev
Date: Fri Jun 21 10:50:49 2013
New Revision: 184557

URL: http://llvm.org/viewvc/llvm-project?rev=184557&view=rev
Log:
[lsan] Try REALLY hard to fix Win build.

Modified:
    compiler-rt/trunk/lib/asan/asan_allocator2.cc
    compiler-rt/trunk/lib/lsan/lsan_common.cc

Modified: compiler-rt/trunk/lib/asan/asan_allocator2.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_allocator2.cc?rev=184557&r1=184556&r2=184557&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_allocator2.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_allocator2.cc Fri Jun 21 10:50:49 2013
@@ -423,8 +423,10 @@ static void *Allocate(uptr size, uptr al
     uptr fill_size = Min(size, (uptr)fl.max_malloc_fill_size);
     REAL(memset)(res, fl.malloc_fill_byte, fill_size);
   }
+#if CAN_SANITIZE_LEAKS
   m->lsan_tag = __lsan::DisabledInThisThread() ? __lsan::kIgnored
                                                : __lsan::kDirectlyLeaked;
+#endif
   // Must be the last mutation of metadata in this function.
   atomic_store((atomic_uint8_t *)m, CHUNK_ALLOCATED, memory_order_release);
   ASAN_MALLOC_HOOK(res, size);

Modified: compiler-rt/trunk/lib/lsan/lsan_common.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lsan_common.cc?rev=184557&r1=184556&r2=184557&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lsan_common.cc (original)
+++ compiler-rt/trunk/lib/lsan/lsan_common.cc Fri Jun 21 10:50:49 2013
@@ -20,13 +20,14 @@
 #include "sanitizer_common/sanitizer_stacktrace.h"
 #include "sanitizer_common/sanitizer_stoptheworld.h"
 
-namespace __lsan {
 #if CAN_SANITIZE_LEAKS
+namespace __lsan {
 
 // This mutex is used to prevent races between DoLeakCheck and SuppressObject.
 BlockingMutex global_mutex(LINKER_INITIALIZED);
 
 THREADLOCAL int disable_counter;
+bool DisabledInThisThread() { return disable_counter > 0; }
 
 Flags lsan_flags;
 
@@ -400,15 +401,8 @@ void LeakReport::PrintSummary() {
       "SUMMARY: LeakSanitizer: %zu byte(s) leaked in %zu allocation(s).\n\n",
       bytes, allocations);
 }
-#endif  // CAN_SANITIZE_LEAKS
-
-bool DisabledInThisThread() {
-#if CAN_SANITIZE_LEAKS
-  return disable_counter > 0;
-#endif
-  return false;
-}
 }  // namespace __lsan
+#endif  // CAN_SANITIZE_LEAKS
 
 using namespace __lsan;  // NOLINT
 





More information about the llvm-commits mailing list