Skip to content

Commit 44a6a44

Browse files
fmayernikic
andauthored
[NFC] [DebugCounter] warn if --debug-counter is unused in NDEBUG (#143057)
Co-authored-by: Nikita Popov <[email protected]>
1 parent 5dc2f44 commit 44a6a44

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

llvm/lib/Support/DebugCounter.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,11 @@ DebugCounter &DebugCounter::instance() {
172172
void DebugCounter::push_back(const std::string &Val) {
173173
if (Val.empty())
174174
return;
175+
#ifdef NDEBUG
176+
// isCountingEnabled is hardcoded to false in NDEBUG.
177+
errs() << "Requested --debug-counter in LLVM build without assertions. This "
178+
"is a no-op.\n";
179+
#endif
175180

176181
// The strings should come in as counter=chunk_list
177182
auto CounterPair = StringRef(Val).split('=');

0 commit comments

Comments
 (0)