summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSergey Matveev <earthdok@google.com>2013-06-03 11:21:34 +0000
committerSergey Matveev <earthdok@google.com>2013-06-03 11:21:34 +0000
commit5e719a705666988781b9735d62cafc808ade60e2 (patch)
tree8c578a4f2bf8713d3815ee7b1ae664c7189dcc35 /include
parentd4a04154b10b51a7ea90b9b8efba7e3045ce168d (diff)
downloadcompiler-rt-5e719a705666988781b9735d62cafc808ade60e2.tar.gz
[lsan] Add __lsan_disable() and __lsan_enable().
Objects allocated after a call to __lsan_disable() will be treated as live memory. Also add a ScopedDisabler. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@183099 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/sanitizer/lsan_interface.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/include/sanitizer/lsan_interface.h b/include/sanitizer/lsan_interface.h
new file mode 100644
index 000000000..cdb3b39dd
--- /dev/null
+++ b/include/sanitizer/lsan_interface.h
@@ -0,0 +1,39 @@
+//===-- sanitizer/lsan_interface.h ------------------------------*- C++ -*-===//
+//
+// 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.
+//
+// Public interface header.
+//===----------------------------------------------------------------------===//
+#ifndef SANITIZER_LSAN_INTERFACE_H
+#define SANITIZER_LSAN_INTERFACE_H
+
+#include <sanitizer/common_interface_defs.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+ // Allocations made between calls to __lsan_disable() and __lsan_enable() will
+ // be treated as non-leaks. Disable/enable pairs can be nested.
+ void __lsan_disable();
+ void __lsan_enable();
+
+#ifdef __cplusplus
+} // extern "C"
+
+namespace __lsan {
+class ScopedDisabler {
+ public:
+ ScopedDisabler() { __lsan_disable(); }
+ ~ScopedDisabler() { __lsan_enable(); }
+};
+} // namespace __lsan
+#endif
+
+#endif // SANITIZER_LSAN_INTERFACE_H