[cfe-commits] Properly visit CXXForRangeStmts in RecursiveASTVisitor

Daniel Jasper djasper at google.com
Tue Jun 12 22:36:48 PDT 2012

Please find the attached patch, which changes the RecursiveASTVisitor
behavior for CXXForRangeStmts, for review.

Depending on whether a RecursiveASTVisitor should visit implicit
declarations, we need to do different things when visiting a range-based
for loop.

If visiting implicit declarations, we can simply visit all children as we
currently do.

If not, we should explicitly visit the loop variable (but not its implicit
initialization) and the range initialization. Otherwise, we would not visit
the range initialization at all (although it is explicit) because it is
part of an implicit VarDecl.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120613/437da6b4/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: visit-for-range-loop.patch
Type: application/octet-stream
Size: 2629 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120613/437da6b4/attachment.obj>

More information about the cfe-commits mailing list