userver: userver/compiler/impl/lsan.hpp Source File
⚠️ This is the documentation for an old userver version. Click here to switch to the latest version.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
lsan.hpp
1#pragma once
2
3#if defined(__has_feature)
4
5#if __has_feature(leak_sanitizer) || __has_feature(address_sanitizer)
6// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
7#define USERVER_IMPL_HAS_LSAN 1
8#else
9// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
10#define USERVER_IMPL_HAS_LSAN 0
11#endif
12
13#else
14
15#if defined(__SANITIZE_ADDRESS__) || defined(__SANITIZE_LEAK__)
16// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
17#define USERVER_IMPL_HAS_LSAN 1
18#else
19// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
20#define USERVER_IMPL_HAS_LSAN 0
21#endif
22
23#endif
24
26#include <sanitizer/lsan_interface.h>
27#endif
28
29USERVER_NAMESPACE_BEGIN
30
31namespace compiler::impl {
32
33template <typename T>
34void LsanIgnoreObject([[maybe_unused]] const T* object) {
36 __lsan_ignore_object(object);
37#endif
38}
39
40} // namespace compiler::impl
41
42USERVER_NAMESPACE_END