LLVM
24.0.0git
lib
Support
Valgrind.cpp
Go to the documentation of this file.
1
//===-- Valgrind.cpp - Implement Valgrind communication ---------*- C++ -*-===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
//
9
// Defines Valgrind communication methods if valgrind.h is available. If we
10
// have valgrind.h but valgrind isn't running, its macros are no-ops.
11
//
12
//===----------------------------------------------------------------------===//
13
14
#include "
llvm/Support/Valgrind.h
"
15
#include <stddef.h>
16
17
#if __has_include(<valgrind/valgrind.h>)
18
#include <valgrind/valgrind.h>
19
20
bool
llvm::sys::RunningOnValgrind
() {
21
return
RUNNING_ON_VALGRIND;
22
}
23
24
void
llvm::sys::ValgrindDiscardTranslations
(
const
void
*Addr,
size_t
Len) {
25
VALGRIND_DISCARD_TRANSLATIONS(Addr, Len);
26
}
27
28
#else
29
30
bool
llvm::sys::RunningOnValgrind
() {
31
return
false
;
32
}
33
34
void
llvm::sys::ValgrindDiscardTranslations
(
const
void
*Addr,
size_t
Len) {
35
}
36
37
#endif
Valgrind.h
llvm::sys::RunningOnValgrind
LLVM_ABI bool RunningOnValgrind()
Definition
Valgrind.cpp:30
llvm::sys::ValgrindDiscardTranslations
LLVM_ABI void ValgrindDiscardTranslations(const void *Addr, size_t Len)
Definition
Valgrind.cpp:34
Generated on
for LLVM by
1.14.0