diff --git a/llvm/lib/Support/DebugCounter.cpp b/llvm/lib/Support/DebugCounter.cpp index 9c4a4429ca0ee..6b65720440f30 100644 --- a/llvm/lib/Support/DebugCounter.cpp +++ b/llvm/lib/Support/DebugCounter.cpp @@ -172,6 +172,11 @@ DebugCounter &DebugCounter::instance() { void DebugCounter::push_back(const std::string &Val) { if (Val.empty()) return; +#ifdef NDEBUG + // isCountingEnabled is hardcoded to false in NDEBUG. + errs() << "Requested --debug-counter in LLVM build without assertions. This " + "is a no-op.\n"; +#endif // The strings should come in as counter=chunk_list auto CounterPair = StringRef(Val).split('=');