<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="" applecontenteditable="true"><br class=""><div><blockquote type="cite" class=""><div class="">On Jun 1, 2017, at 1:49 PM, Craig Topper via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" class="">cfe-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Adding cfe-dev</div><div class="gmail_extra"><br clear="all" class=""><div class=""><div class="gmail_signature" data-smartmail="gmail_signature">~Craig</div></div>
<br class=""><div class="gmail_quote">On Thu, Jun 1, 2017 at 1:46 PM, Grang, Mandeep Singh via llvm-dev <span dir="ltr" class=""><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" class="">llvm-dev@lists.llvm.org</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF" class=""><p class="">I see that the following test fails if reverse iteration of
SmallPtrSet is enabled:</p><p class=""><i class="">clang/test/SemaCXX/warn-loop-<wbr class="">analysis.cpp</i></p></div></blockquote></div></div></div></blockquote>I think I saw a bot complaining about this. Could you back out the change until these failures can be addressed? (Apologies if you already have.)<br class=""><br class=""><blockquote type="cite" class=""><div class=""><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div text="#000000" bgcolor="#FFFFFF" class=""><p class="">This is because in SemaStmt.cpp we iterate SmallPtrSet and output
warnings about the variables not used in the loop.<br class="">
</p><p class="">Expected output: <i class="">warning: variables 'i', 'j', and 'k' used in
loop condition not modified</i></p><p class="">Output with reverse iteration: <i class="">warning: variables 'k', 'j',
and 'i' used in loop condition not</i></p><p class="">I would like the community's opinion on whether this is something
worth fixing? In this case, should the output always be the same
irrespective of the iteration order?<br class=""></p></div></blockquote></div></div></div></blockquote><div>Yes, I think so. Running the compiler twice should produce identical diagnostics.</div><br class=""><blockquote type="cite" class=""><div class=""><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div text="#000000" bgcolor="#FFFFFF" class=""><p class="">
</p><p class=""> If yes, then we have 2 alternatives:</p><p class="">1. Change SmallPtrSet to SmallVector for the container (VarDecls)
being iterated - this may have a compile time impact (need to
measure).</p></div></blockquote></div></div></div></blockquote><blockquote type="cite" class=""><div class=""><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div text="#000000" bgcolor="#FFFFFF" class=""><p class="">2. Sort the container (VarDecls) before iteration. We can sort
based on decl source location and decl name. Not sure if these
guaranteed to be unique?</p></div></blockquote></div></div></div></blockquote><span class="">CheckForLoopConditionalStatement is hot, relative to the code that actually emits the diagnostic [1]. So </span>I'd prefer the second option.</div><div><br class=""></div><div>[1] <a href="http://lab.llvm.org:8080/coverage/coverage-reports/clang/coverage/Users/buildslave/jenkins/sharedspace/clang-stage2-coverage-R@2/llvm/tools/clang/lib/Sema/SemaStmt.cpp.html#L1454" class="">http://lab.llvm.org:8080/coverage/coverage-reports/clang/coverage/Users/buildslave/jenkins/sharedspace/clang-stage2-coverage-R@2/llvm/tools/clang/lib/Sema/SemaStmt.cpp.html#L1454</a></div><div><br class=""></div><div>vedant<br class=""><blockquote type="cite" class=""><div class=""><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div text="#000000" bgcolor="#FFFFFF" class=""><p class="">Thanks,</p><p class="">Mandeep<br class="">
</p>
</div>
<br class="">______________________________<wbr class="">_________________<br class="">
LLVM Developers mailing list<br class="">
<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a><br class="">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank" class="">http://lists.llvm.org/cgi-bin/<wbr class="">mailman/listinfo/llvm-dev</a><br class="">
<br class=""></blockquote></div><br class=""></div>
_______________________________________________<br class="">cfe-dev mailing list<br class=""><a href="mailto:cfe-dev@lists.llvm.org" class="">cfe-dev@lists.llvm.org</a><br class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev<br class=""></div></blockquote></div><br class=""></body></html>