[cfe-commits] [Patch] Extend -Wloop-analysis to while and do-while loops

Richard Trieu rtrieu at google.com
Thu Jun 7 18:19:00 PDT 2012


This patch extends the loops checks that originally only had checked
for-loops to also check while and do-while loops.  Changes are:

- Add a bit to VarDecl to keep track if a variable has been passed by
reference (but not const reference) or had its address taken.
- If the bit above is set on a variable, do not emit the warning.  Also,
don't emit the warning for parameter variables in while loops.
- Don't warn on variable declared inside a conditional.
- Don't warn when there is a function call to a noreturn function inside
the loop.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120607/e4170650/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: loop-analysis.patch
Type: application/octet-stream
Size: 11847 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120607/e4170650/attachment.obj>


More information about the cfe-commits mailing list