[cfe-dev] Reporting false positives detected by Clang staticanalyzer

Alexander Riccio via cfe-dev cfe-dev at lists.llvm.org
Thu Apr 7 18:47:40 PDT 2016


I remember seeing something about the static analyzer checking asserts in the docs, how well does that actually work?

sent from my (stupid) windows phone

-----Original Message-----
From: "Devin Coughlin via cfe-dev" <cfe-dev at lists.llvm.org>
Sent: ‎4/‎7/‎2016 7:28 PM
To: "Apelete Seketeli" <apelete at seketeli.net>
Cc: "cfe-dev" <cfe-dev at lists.llvm.org>
Subject: Re: [cfe-dev] Reporting false positives detected by Clang staticanalyzer


> On Apr 7, 2016, at 1:19 PM, Apelete Seketeli via cfe-dev <cfe-dev at lists.llvm.org> wrote:
> 
> Is there a way to report/declare such false positives in order to
> filter them out in the subsequent runs of the static analyzer ?

Unfortunately, there is not a holistic mechanism for suppressing false positives from subsequent analyzer runs.

For many false positives, there is some underlying invariant that the analyzer doesn’t understand. For these, you can often add a carefully-placed assert() to then code to tell the analyzer about the invariant (and get dynamic checking of the invariant when assertions are enabled!). You can also hide code from the analyzer with:

#ifndef __clang_analyzer__
// Code not to be analyzed
#endif

There is a FAQ describing these suppression mechanisms and others at <http://clang-analyzer.llvm.org/faq.html>.

Devin
_______________________________________________
cfe-dev mailing list
cfe-dev at lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160407/9be02fba/attachment.html>


More information about the cfe-dev mailing list