<div dir="ltr">I'd guess that there's not much interest in fixing shadowing - that not enough of them are actually buggy (represent cases where the developer intended something other than what they wrote/what the compiler understood).</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Apr 22, 2020 at 3:36 PM Mandeep Singh Grang via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small"><div class="gmail_default" style="font-family:arial,sans-serif">Hi,</div><div class="gmail_default" style="font-family:arial,sans-serif">As part of compliance for our <a href="https://github.com/microsoft/checkedc-clang" target="_blank">Checked C</a> LLVM compiler, we at Microsoft ran the <a href="https://www.codeproject.com/Articles/167588/Using-PREfast-for-Static-Code-Analysis" target="_blank">PREfast</a> static analysis tool on the entire llvm/clang codebase. The tool reported hundreds of warnings due to variables being shadowed.For example:</div><div class="gmail_default" style="font-family:arial,sans-serif"><br></div><div class="gmail_default" style="font-family:Arial,Helvetica,sans-serif"><font face="monospace">clang/lib/Sema/TreeTransform.h(3709) Local declaration of 'I' hides declaration of the same name in outer scope. See previous declaration at line '3653'.</font><br></div><div class="gmail_default" style="font-family:Arial,Helvetica,sans-serif"><font face="monospace"><br></font></div><div class="gmail_default" style="font-family:Arial,Helvetica,sans-serif">We can upstream fixes to these (and other) warnings if the community would like them fixed. The full list of warnings can be found <a href="https://docs.google.com/spreadsheets/d/1h_3tHxsgBampxb7PXoB5lgwiBSpTty9RLe5maIQxnTk/edit?usp=sharing" target="_blank">here</a>.</div><div class="gmail_default" style="font-family:Arial,Helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:Arial,Helvetica,sans-serif">Also, is there a reason we do not turn on the -Wshadow flag by default for llvm builds?</div><div class="gmail_default" style="font-family:Arial,Helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:Arial,Helvetica,sans-serif">Thanks,</div><div class="gmail_default" style="font-family:Arial,Helvetica,sans-serif">Mandeep</div></div></div>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div>