When clang-tidy suppresses a warning, ignored by NOLINT, it doesn't suppress related notes. This leads to an assertion/crash, as described in this bug: https://llvm.org/bugs/show_bug.cgi?id=30565
The minimal reproducible example is as follows (run with 'clang-tidy source.cpp -- -c'):
- header.h:
void TriggerWarning(const int& In, int& Out) { if (In > 123) // NOLINT Out = 123; }
- source.cpp:
#include "header.h" void MaybeInitialize(int &Out) { int In; TriggerWarning(In, Out); }
Suppressing notes after suppressing a warning fixes the problem and produces a consistent diagnostics output.
Change ShouldIgnoreNotes to a class member and rename to LastErrorWasIgnored or similar.