[llvm] [NFC] [DebugCounter] warn if --debug-counter is unused in NDEBUG (PR #143057)
Florian Mayer via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 5 18:30:22 PDT 2025
https://github.com/fmayer created https://github.com/llvm/llvm-project/pull/143057
None
>From fcb2062d4f3f0af9cfa797e7cc9d97a27aa41edf Mon Sep 17 00:00:00 2001
From: Florian Mayer <fmayer at google.com>
Date: Thu, 5 Jun 2025 18:30:09 -0700
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
=?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Created using spr 1.3.4
---
llvm/lib/Support/DebugCounter.cpp | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/llvm/lib/Support/DebugCounter.cpp b/llvm/lib/Support/DebugCounter.cpp
index 9c4a4429ca0ee..1fbd700afa1d7 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 non-debug LLVM build. This is a "
+ "no-op.\n";
+#endif
// The strings should come in as counter=chunk_list
auto CounterPair = StringRef(Val).split('=');
More information about the llvm-commits
mailing list