<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi Andrzej,<div class=""><br class=""></div><div class="">To add to what Gabor has mentioned:</div><div class=""><br class=""></div><div class="">The first two links you have posted refer to clang-tidy.</div><div class="">This is a different tool from clang static analyzer, and is maintained in a separate repository.</div><div class="">The main difference is that clang-tidy pattern-matches on AST,</div><div class="">while clang static analyzer performs symbolic execution.</div><div class=""><br class=""></div><div class="">Clang static analyzer does not parse “// NOLINT” comments, nor comments in general.</div><div class="">While this is a limitation, it can be also seen as a good thing, as it forces the actual executable code</div><div class="">to be a single canonical source of analysis results.</div><div class=""><br class=""></div><div class="">Strategies for dealing with false positives are described at the clang static analyzer webpage: <a href="http://clang-analyzer.llvm.org/faq.html" class="">http://clang-analyzer.llvm.org/faq.html</a>,</div><div class="">without looking at the whole code it is hard to tell which one is the most applicable.</div><div class=""><br class=""></div><div class="">Regards,</div><div class="">George</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><div><blockquote type="cite" class=""><div class="">On Sep 5, 2017, at 12:03 AM, Andrzej Krzemienski via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" class="">cfe-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class=""><div class=""><div class=""><div class=""><div class=""><div class=""><div class="">Hi,<br class=""></div>I would like to ask for an advice from clang developers about suppressing warnings from the static analyzer.<br class=""><br class=""></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 class=""><br class=""><a href="https://github.com/google/googletest/issues/853" class="">https://github.com/google/googletest/issues/853</a><br class=""><a href="https://stackoverflow.com/questions/39527160/clang-tidy-how-to-suppress-warnings/39544324#39544324" class="">https://stackoverflow.com/questions/39527160/clang-tidy-how-to-suppress-warnings/39544324#39544324</a><br class=""><a href="https://bugs.llvm.org/show_bug.cgi?id=28053" class="">https://bugs.llvm.org/show_bug.cgi?id=28053</a><br class=""><br class=""></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 class=""><br class="">```<br class="">gtest/googlemock/include/gmock/gmock-spec-builders.h:1274:5: warning: Use of memory after it is freed<br class="">    return function_mocker_->AddNewExpectation( // NOLINT<br class="">    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br class="">```<br class=""><br class=""></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 class=""><br class=""></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 class=""><br class=""></div>Thanks,<br class=""></div>&rzej;<br class=""><div class=""><div class=""><div class=""><div class=""><br class=""></div></div></div></div></div>
_______________________________________________<br class="">cfe-dev mailing list<br class=""><a href="mailto:cfe-dev@lists.llvm.org" class="">cfe-dev@lists.llvm.org</a><br class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev<br class=""></div></blockquote></div><br class=""></div></body></html>