[cfe-commits] r155835 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaStmt.cpp test/SemaCXX/warn-loop-analysis.cpp

Richard Trieu rtrieu at google.com
Thu May 3 15:50:05 PDT 2012


On Thu, May 3, 2012 at 1:51 PM, Nico Weber <thakis at chromium.org> wrote:

> Hi Richard,
>
> if you're looking for data if this should be on by default: This has 0
> false positives in all of chromium (including tests, all dependencies) and
> found 0 bugs.
>

Thanks for the data, Nico.

>
> (I did put in a true positive ("for (int i; i < 5;) {}") somewhere and
> verified that that got detected, to make sure I enabled the warning
> correctly. My first attempt to introduce a true positive, "int i; while (i
> > 0) {}" didn't fire, I suppose while loops aren't handled intentionally?)
>

While and do-while loops aren't covered due to false positives, such as
this code:

void Run(int times) {
  while (times == -1) DoStuff();
  for (int i = 0; i< times; i++) DoStuff();
}

There's also some macros that seems to trigger this warning that I'm
investigating.

>
> Nico
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120503/b7e6bb37/attachment.html>


More information about the cfe-commits mailing list