2010-03-15 12:57:55 +08:00
|
|
|
//===-- Valgrind.cpp - Implement Valgrind communication ---------*- C++ -*-===//
|
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2010-03-15 12:57:55 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// Defines Valgrind communication methods, if HAVE_VALGRIND_VALGRIND_H is
|
|
|
|
// defined. If we have valgrind.h but valgrind isn't running, its macros are
|
|
|
|
// no-ops.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2022-02-01 03:57:18 +08:00
|
|
|
#include <stddef.h>
|
2010-11-30 02:16:10 +08:00
|
|
|
#include "llvm/Support/Valgrind.h"
|
2010-03-15 12:57:55 +08:00
|
|
|
#include "llvm/Config/config.h"
|
|
|
|
|
|
|
|
#if HAVE_VALGRIND_VALGRIND_H
|
|
|
|
#include <valgrind/valgrind.h>
|
|
|
|
|
|
|
|
bool llvm::sys::RunningOnValgrind() {
|
|
|
|
return RUNNING_ON_VALGRIND;
|
|
|
|
}
|
|
|
|
|
|
|
|
void llvm::sys::ValgrindDiscardTranslations(const void *Addr, size_t Len) {
|
2011-07-02 21:14:22 +08:00
|
|
|
VALGRIND_DISCARD_TRANSLATIONS(Addr, Len);
|
2010-03-15 12:57:55 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#else // !HAVE_VALGRIND_VALGRIND_H
|
|
|
|
|
|
|
|
bool llvm::sys::RunningOnValgrind() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void llvm::sys::ValgrindDiscardTranslations(const void *Addr, size_t Len) {
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // !HAVE_VALGRIND_VALGRIND_H
|