Skip to content

Commit

Permalink
Remove the NotUnderValgrind caching flag
Browse files Browse the repository at this point in the history
The motivation for this caching wasn't clear, remove it in an effort to
simplify the code and make libSupport free of global dynamic constructor.

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D106206
  • Loading branch information
joker-eph committed Jul 26, 2021
1 parent c2dacb1 commit 7d9a2c7
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions llvm/lib/Support/Valgrind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,11 @@
#if HAVE_VALGRIND_VALGRIND_H
#include <valgrind/valgrind.h>

static bool InitNotUnderValgrind() {
return !RUNNING_ON_VALGRIND;
}

// This bool is negated from what we'd expect because code may run before it
// gets initialized. If that happens, it will appear to be 0 (false), and we
// want that to cause the rest of the code in this file to run the
// Valgrind-provided macros.
static const bool NotUnderValgrind = InitNotUnderValgrind();

bool llvm::sys::RunningOnValgrind() {
if (NotUnderValgrind)
return false;
return RUNNING_ON_VALGRIND;
}

void llvm::sys::ValgrindDiscardTranslations(const void *Addr, size_t Len) {
if (NotUnderValgrind)
return;

VALGRIND_DISCARD_TRANSLATIONS(Addr, Len);
}

Expand Down

0 comments on commit 7d9a2c7

Please sign in to comment.