dblaikie added a comment.
Seems plausible - maybe walking the scopes to count the range-for loops would
produce a better number, but would be slower. :/ Dunno.
================
Comment at: lib/Sema/SemaStmt.cpp:2346
+ // Assume the variables are nested in the inner scope (loop body).
+ const auto DepthStr = std::to_string(S->getDepth() >> 1);
VarDecl *BeginVar = BuildForRangeVarDecl(*this, ColonLoc, AutoType,
----------------
Why shifted right/divided by two? (I'd probably write this as "/ 2" rather
thane ">> 1" if this is what's)
I guess this is because a range-for introduces two (actually 3, I think) scopes?
But what about if there are other random scopes that could be present? Does
that adversely affect anything here?
https://reviews.llvm.org/D42813
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits