[PATCH] [lsan] Define CAN_SANITIZE_LEAKS macro.
Sergey Matveev
earthdok at google.com
Tue May 21 04:22:45 PDT 2013
Hi kcc, glider,
http://llvm-reviews.chandlerc.com/D835
Files:
lib/lsan/lsan_common.cc
lib/lsan/lsan_common.h
lib/lsan/lsan_common_linux.cc
Index: lib/lsan/lsan_common.cc
===================================================================
--- lib/lsan/lsan_common.cc
+++ lib/lsan/lsan_common.cc
@@ -21,7 +21,7 @@
#include "sanitizer_common/sanitizer_stoptheworld.h"
namespace __lsan {
-
+#if CAN_SANITIZE_LEAKS
Flags lsan_flags;
static void InitializeFlags() {
@@ -381,5 +381,8 @@
remaining > 1 ? "s" : "");
}
}
-
+#else // CAN_SANITIZE_LEAKS
+void InitCommonLsan() {}
+void DoLeakCheck() {}
+#endif // CAN_SANITIZE_LEAKS
} // namespace __lsan
Index: lib/lsan/lsan_common.h
===================================================================
--- lib/lsan/lsan_common.h
+++ lib/lsan/lsan_common.h
@@ -17,8 +17,15 @@
#include "sanitizer_common/sanitizer_common.h"
#include "sanitizer_common/sanitizer_internal_defs.h"
+#include "sanitizer_common/sanitizer_platform.h"
#include "sanitizer_common/sanitizer_symbolizer.h"
+#if SANITIZER_LINUX && defined(__x86_64__)
+#define CAN_SANITIZE_LEAKS 1
+#else
+#define CAN_SANITIZE_LEAKS 0
+#endif
+
namespace __lsan {
// Chunk tags.
Index: lib/lsan/lsan_common_linux.cc
===================================================================
--- lib/lsan/lsan_common_linux.cc
+++ lib/lsan/lsan_common_linux.cc
@@ -13,9 +13,9 @@
//===----------------------------------------------------------------------===//
#include "sanitizer_common/sanitizer_platform.h"
-#if SANITIZER_LINUX
#include "lsan_common.h"
+#if CAN_SANITIZE_LEAKS && SANITIZER_LINUX
#include <link.h>
#include "sanitizer_common/sanitizer_common.h"
@@ -120,4 +120,4 @@
}
} // namespace __lsan
-#endif // SANITIZER_LINUX
+#endif // CAN_SANITIZE_LEAKS && SANITIZER_LINUX
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D835.1.patch
Type: text/x-patch
Size: 1684 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130521/0d8cffaa/attachment.bin>
More information about the llvm-commits
mailing list