[compiler-rt] r198921 - [lsan] rename __lsan_is_turned_off to LeakSanitizerIsTurnedOffForTheCurrentProcess (leave the old variant for now for compatibility)

Kostya Serebryany kcc at google.com
Thu Jan 9 23:58:25 PST 2014


Author: kcc
Date: Fri Jan 10 01:58:25 2014
New Revision: 198921

URL: http://llvm.org/viewvc/llvm-project?rev=198921&view=rev
Log:
[lsan] rename __lsan_is_turned_off to LeakSanitizerIsTurnedOffForTheCurrentProcess (leave the old variant for now for compatibility)

Modified:
    compiler-rt/trunk/include/sanitizer/lsan_interface.h
    compiler-rt/trunk/lib/lsan/lit_tests/TestCases/link_turned_off.cc
    compiler-rt/trunk/lib/lsan/lsan_common.cc
    compiler-rt/trunk/lib/lsan/lsan_common.h

Modified: compiler-rt/trunk/include/sanitizer/lsan_interface.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/include/sanitizer/lsan_interface.h?rev=198921&r1=198920&r2=198921&view=diff
==============================================================================
--- compiler-rt/trunk/include/sanitizer/lsan_interface.h (original)
+++ compiler-rt/trunk/include/sanitizer/lsan_interface.h Fri Jan 10 01:58:25 2014
@@ -45,6 +45,11 @@ extern "C" {
   // for the program it is linked into (if the return value is non-zero). This
   // function must be defined as returning a constant value; any behavior beyond
   // that is unsupported.
+  int LeakSanitizerIsTurnedOffForTheCurrentProcess();
+
+  // Same as LeakSanitizerIsTurnedOffForTheCurrentProcess, but deprecated.
+  // If both functions are defined only
+  // LeakSanitizerIsTurnedOffForTheCurrentProcess is used.
   int __lsan_is_turned_off();
 
   // Calling this function makes LSan enter the leak checking phase immediately.

Modified: compiler-rt/trunk/lib/lsan/lit_tests/TestCases/link_turned_off.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/TestCases/link_turned_off.cc?rev=198921&r1=198920&r2=198921&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lit_tests/TestCases/link_turned_off.cc (original)
+++ compiler-rt/trunk/lib/lsan/lit_tests/TestCases/link_turned_off.cc Fri Jan 10 01:58:25 2014
@@ -9,7 +9,7 @@
 int argc_copy;
 
 extern "C" {
-int __lsan_is_turned_off() {
+int LeakSanitizerIsTurnedOffForTheCurrentProcess() {
   return (argc_copy == 1);
 }
 }

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=198921&r1=198920&r2=198921&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lsan_common.cc (original)
+++ compiler-rt/trunk/lib/lsan/lsan_common.cc Fri Jan 10 01:58:25 2014
@@ -423,8 +423,13 @@ void DoLeakCheck() {
   static bool already_done;
   if (already_done) return;
   already_done = true;
-  if (&__lsan_is_turned_off && __lsan_is_turned_off())
-    return;
+  if (&LeakSanitizerIsTurnedOffForTheCurrentProcess) {
+    if (LeakSanitizerIsTurnedOffForTheCurrentProcess())
+      return;
+  } else if (&__lsan_is_turned_off) {
+    if (__lsan_is_turned_off())
+      return;
+  }
 
   DoLeakCheckParam param;
   param.success = false;
@@ -714,5 +719,9 @@ SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_
 int __lsan_is_turned_off() {
   return 0;
 }
+SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE
+int LeakSanitizerIsTurnedOffForTheCurrentProcess() {
+  return 0;
+}
 #endif
 }  // extern "C"

Modified: compiler-rt/trunk/lib/lsan/lsan_common.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lsan_common.h?rev=198921&r1=198920&r2=198921&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lsan_common.h (original)
+++ compiler-rt/trunk/lib/lsan/lsan_common.h Fri Jan 10 01:58:25 2014
@@ -190,6 +190,8 @@ class LsanMetadata {
 extern "C" {
 SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE
 int __lsan_is_turned_off();
+SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE
+int LeakSanitizerIsTurnedOffForTheCurrentProcess();
 
 SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE
 const char *__lsan_default_suppressions();





More information about the llvm-commits mailing list