Re: [PATCH] D20911: [asan] Turn LSan-related #if’s into regular if’s in ASan initializer

Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 7 12:20:21 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL272047: [asan] Turn LSan-related #if’s into regular if’s in ASan initializer (authored by kuba.brecka).

Changed prior to commit:
  http://reviews.llvm.org/D20911?vs=59380&id=59931#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20911

Files:
  compiler-rt/trunk/lib/asan/asan_rtl.cc
  compiler-rt/trunk/lib/lsan/lsan_common.cc

Index: compiler-rt/trunk/lib/lsan/lsan_common.cc
===================================================================
--- compiler-rt/trunk/lib/lsan/lsan_common.cc
+++ compiler-rt/trunk/lib/lsan/lsan_common.cc
@@ -650,6 +650,13 @@
 }
 
 } // namespace __lsan
+#else // CAN_SANITIZE_LEAKS
+namespace __lsan {
+void InitCommonLsan() { }
+void DoLeakCheck() { }
+void DisableInThisThread() { }
+void EnableInThisThread() { }
+}
 #endif // CAN_SANITIZE_LEAKS
 
 using namespace __lsan;  // NOLINT
Index: compiler-rt/trunk/lib/asan/asan_rtl.cc
===================================================================
--- compiler-rt/trunk/lib/asan/asan_rtl.cc
+++ compiler-rt/trunk/lib/asan/asan_rtl.cc
@@ -546,25 +546,25 @@
   force_interface_symbols();  // no-op.
   SanitizerInitializeUnwinder();
 
-#if CAN_SANITIZE_LEAKS
-  __lsan::InitCommonLsan();
-  if (common_flags()->detect_leaks && common_flags()->leak_check_at_exit) {
-    Atexit(__lsan::DoLeakCheck);
+  if (CAN_SANITIZE_LEAKS) {
+    __lsan::InitCommonLsan();
+    if (common_flags()->detect_leaks && common_flags()->leak_check_at_exit) {
+      Atexit(__lsan::DoLeakCheck);
+    }
   }
-#endif  // CAN_SANITIZE_LEAKS
 
 #if CAN_SANITIZE_UB
   __ubsan::InitAsPlugin();
 #endif
 
   InitializeSuppressions();
 
-  {
-#if CAN_SANITIZE_LEAKS
+  if (CAN_SANITIZE_LEAKS) {
     // LateInitialize() calls dlsym, which can allocate an error string buffer
     // in the TLS.  Let's ignore the allocation to avoid reporting a leak.
     __lsan::ScopedInterceptorDisabler disabler;
-#endif
+    Symbolizer::LateInitialize();
+  } else {
     Symbolizer::LateInitialize();
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20911.59931.patch
Type: text/x-patch
Size: 1625 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160607/3b832f7d/attachment.bin>


More information about the llvm-commits mailing list