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.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
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"
|
2015-10-16 03:41:54 +08:00
|
|
|
#include <cstddef>
|
2010-03-15 12:57:55 +08:00
|
|
|
|
|
|
|
#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
|