summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>2013-01-31 09:58:59 +0000
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>2013-01-31 09:58:59 +0000
commitea2d8780e9c78628fe5e3312ca4c17c054156c83 (patch)
tree72f8d01f1abf5b7c424bef6a733d003cb8764068 /include
parente22df330a344ddbd536e6bcbc542290953ab4a9d (diff)
downloadllvm-ea2d8780e9c78628fe5e3312ca4c17c054156c83.tar.gz
llvm-ea2d8780e9c78628fe5e3312ca4c17c054156c83.tar.bz2
llvm-ea2d8780e9c78628fe5e3312ca4c17c054156c83.tar.xz
Annotate BumpPtrAllocator for MemorySanitizer.
This change adds MemorySanitizer annotations to BumpPtrAllocator to improve report quality. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174051 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Config/config.h.cmake3
-rw-r--r--include/llvm/Support/Compiler.h18
2 files changed, 21 insertions, 0 deletions
diff --git a/include/llvm/Config/config.h.cmake b/include/llvm/Config/config.h.cmake
index 9487083431..b0b8104205 100644
--- a/include/llvm/Config/config.h.cmake
+++ b/include/llvm/Config/config.h.cmake
@@ -468,6 +468,9 @@
/* Define to 1 if the system has the type `u_int64_t'. */
#cmakedefine HAVE_U_INT64_T ${HAVE_U_INT64_T}
+/* Define to 1 if you have the <sanitizer/msan_interface.h> header file. */
+#cmakedefine HAVE_SANITIZER_MSAN_INTERFACE_H ${HAVE_SANITIZER_MSAN_INTERFACE_H}
+
/* Define to 1 if you have the <valgrind/valgrind.h> header file. */
#cmakedefine HAVE_VALGRIND_VALGRIND_H ${HAVE_VALGRIND_VALGRIND_H}
diff --git a/include/llvm/Support/Compiler.h b/include/llvm/Support/Compiler.h
index 96af756dde..36539f6d34 100644
--- a/include/llvm/Support/Compiler.h
+++ b/include/llvm/Support/Compiler.h
@@ -15,6 +15,8 @@
#ifndef LLVM_SUPPORT_COMPILER_H
#define LLVM_SUPPORT_COMPILER_H
+#include "llvm/Config/config.h"
+
#ifndef __has_feature
# define __has_feature(x) 0
#endif
@@ -293,4 +295,20 @@
# define LLVM_FUNCTION_NAME __func__
#endif
+/// \macro LLVM_ENABLE_MSAN_ANNOTATIONS
+/// \brief Are MemorySanitizer annotations available.
+#if defined(HAVE_SANITIZER_MSAN_INTERFACE_H)
+# include <sanitizer/msan_interface.h>
+#else
+# define __msan_allocated_memory(p, size)
+#endif
+
+/// \macro LLVM_MEMORY_SANITIZER_BUILD
+/// \brief Whether LLVM itself is built with MemorySanitizer instrumentation.
+#if __has_feature(memory_sanitizer)
+# define LLVM_MEMORY_SANITIZER_BUILD 1
+#else
+# define LLVM_MEMORY_SANITIZER_BUILD 0
+#endif
+
#endif