<div dir="ltr"><div><div><div><div><div><div><div>Hi,<br></div>I would like to ask for an advice from clang developers about suppressing warnings from the static analyzer.<br><br></div>I am calling the analyzer directly from clang c++ compiler, with `clang++ --analyze`. I am compiling a unit-test project that is using Google's Gmock. I am getting a well known and described false positive:<br><br><a href="https://github.com/google/googletest/issues/853">https://github.com/google/googletest/issues/853</a><br><a href="https://stackoverflow.com/questions/39527160/clang-tidy-how-to-suppress-warnings/39544324#39544324">https://stackoverflow.com/questions/39527160/clang-tidy-how-to-suppress-warnings/39544324#39544324</a><br><a href="https://bugs.llvm.org/show_bug.cgi?id=28053">https://bugs.llvm.org/show_bug.cgi?id=28053</a><br><br></div>So, I am trying to manually disable it by putting `// NOLINT` in gmocks code. As a result, I still get the analyzer warning:<br><br>```<br>gtest/googlemock/include/gmock/gmock-spec-builders.h:1274:5: warning: Use of memory after it is freed<br>    return function_mocker_->AddNewExpectation( // NOLINT<br>    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>```<br><br></div>which I find quite surprising, because even in the warning message I get the text `// NOLINT` but the bug is still not disabled.<br><br></div>Maybe someone could help me figure out what is going on. Can you not suppress warnings when running analyzer directly from clang c++ compiler? Or is there a different way for suppressing the analyzer warnings?<br><br></div>Thanks,<br></div>&rzej;<br><div><div><div><div><br></div></div></div></div></div>