[PATCH] Warn on suspicious increments/decrements in for loops

Richard Trieu rtrieu at google.com
Thu Apr 4 16:20:46 PDT 2013


Add a new warning to -Wloop-analysis to warn on questionable increments/decrements in for loop bodies.  This warning triggers when the last statement in the loop is the same as the third expression in the for-loop header and there is no continue statements in the loop body.

Idea for this warning came from PR15636
http://llvm.org/bugs/show_bug.cgi?id=15636

http://llvm-reviews.chandlerc.com/D628

Files:
  test/SemaCXX/warn-loop-analysis.cpp
  include/clang/Basic/DiagnosticGroups.td
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/Sema/SemaStmt.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D628.1.patch
Type: text/x-patch
Size: 8461 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130404/df901ac7/attachment.bin>


More information about the cfe-commits mailing list