[PATCH] D23649: [ADT] Change the range-based for loop in DFS to normal loop. NFC.
Tim Shen via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 18 23:22:35 PDT 2016
timshen updated this revision to Diff 68651.
timshen added a comment.
Add comment for the change.
https://reviews.llvm.org/D23649
Files:
include/llvm/ADT/DepthFirstIterator.h
Index: include/llvm/ADT/DepthFirstIterator.h
===================================================================
--- include/llvm/ADT/DepthFirstIterator.h
+++ include/llvm/ADT/DepthFirstIterator.h
@@ -107,7 +107,11 @@
if (!Opt)
Opt.emplace(GT::child_begin(Node));
- for (NodeRef Next : make_range(*Opt, GT::child_end(Node))) {
+ // Notice that we use `auto &It =` here, as opposed to `auto It =` or
+ // range-based for loop, so that VisitStack.back().second actually gets
+ // updated.
+ for (auto &It = *Opt; It != GT::child_end(Node); ++It) {
+ NodeRef Next = *It;
// Has our next sibling been visited?
if (this->Visited.insert(Next).second) {
// No, do it now.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23649.68651.patch
Type: text/x-patch
Size: 744 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160819/f4b9dcb0/attachment.bin>
More information about the llvm-commits
mailing list