27 #ifndef OPM_VALGRIND_HPP
28 #define OPM_VALGRIND_HPP
31 #include <valgrind/memcheck.h>
42 #if !defined NDEBUG && HAVE_VALGRIND
43 return RUNNING_ON_VALGRIND;
76 #if !defined NDEBUG && HAVE_VALGRIND
77 auto tmp = VALGRIND_CHECK_MEM_IS_DEFINED(&value,
sizeof(T));
108 #if !defined NDEBUG && HAVE_VALGRIND
109 auto tmp = VALGRIND_CHECK_MEM_IS_ADDRESSABLE(&value,
sizeof(T));
143 [[maybe_unused]]
int size)
145 #if !defined NDEBUG && HAVE_VALGRIND
146 auto tmp = VALGRIND_CHECK_MEM_IS_DEFINED(value, size*
sizeof(T));
173 #if !defined NDEBUG && HAVE_VALGRIND
174 VALGRIND_MAKE_MEM_UNDEFINED(&value,
sizeof(T));
198 [[maybe_unused]]
int size)
200 #if !defined NDEBUG && HAVE_VALGRIND
201 VALGRIND_MAKE_MEM_UNDEFINED(value, size*
sizeof(T));
224 #if !defined NDEBUG && HAVE_VALGRIND
225 VALGRIND_MAKE_MEM_DEFINED(&value,
sizeof(T));
249 [[maybe_unused]]
int n)
251 #if !defined NDEBUG && HAVE_VALGRIND
252 VALGRIND_MAKE_MEM_DEFINED(value, n*
sizeof(T));
275 #if !defined NDEBUG && HAVE_VALGRIND
276 VALGRIND_MAKE_MEM_NOACCESS(&value,
sizeof(T));
298 [[maybe_unused]]
int size)
300 #if !defined NDEBUG && HAVE_VALGRIND
301 VALGRIND_MAKE_MEM_NOACCESS(value, size*
sizeof(T));
void SetDefined([[maybe_unused]] const T &value)
Make the memory on which an object resides defined.
Definition: Valgrind.hpp:222
bool IsRunning()
Returns whether the program is running under Valgrind or not.
Definition: Valgrind.hpp:40
bool CheckAddressable([[maybe_unused]] const T &value)
Make valgrind complain if any of the memory occupied by an object is not addressable.
Definition: Valgrind.hpp:106
void SetUndefined([[maybe_unused]] const T &value)
Make the memory on which an object resides undefined in valgrind runs.
Definition: Valgrind.hpp:171
bool CheckDefined([[maybe_unused]] const T &value)
Make valgrind complain if any of the memory occupied by an object is undefined.
Definition: Valgrind.hpp:74
void SetNoAccess([[maybe_unused]] const T &value)
Make valgrind complain if an object's memory is accessed.
Definition: Valgrind.hpp:273