Mandeep Singh Grang via llvm-dev
2020-Apr-22 22:36 UTC
[llvm-dev] Warnings after running PREfast on LLVM
Hi, As part of compliance for our Checked C <https://github.com/microsoft/checkedc-clang> LLVM compiler, we at Microsoft ran the PREfast <https://www.codeproject.com/Articles/167588/Using-PREfast-for-Static-Code-Analysis> static analysis tool on the entire llvm/clang codebase. The tool reported hundreds of warnings due to variables being shadowed.For example: 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'. We can upstream fixes to these (and other) warnings if the community would like them fixed. The full list of warnings can be found here <https://docs.google.com/spreadsheets/d/1h_3tHxsgBampxb7PXoB5lgwiBSpTty9RLe5maIQxnTk/edit?usp=sharing> . Also, is there a reason we do not turn on the -Wshadow flag by default for llvm builds? Thanks, Mandeep -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200422/c7188104/attachment.html>
David Blaikie via llvm-dev
2020-Apr-22 22:45 UTC
[llvm-dev] [cfe-dev] Warnings after running PREfast on LLVM
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). On Wed, Apr 22, 2020 at 3:36 PM Mandeep Singh Grang via cfe-dev < cfe-dev at lists.llvm.org> wrote:> Hi, > As part of compliance for our Checked C > <https://github.com/microsoft/checkedc-clang> LLVM compiler, we at > Microsoft ran the PREfast > <https://www.codeproject.com/Articles/167588/Using-PREfast-for-Static-Code-Analysis> static > analysis tool on the entire llvm/clang codebase. The tool reported hundreds > of warnings due to variables being shadowed.For example: > > 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'. > > We can upstream fixes to these (and other) warnings if the community would > like them fixed. The full list of warnings can be found here > <https://docs.google.com/spreadsheets/d/1h_3tHxsgBampxb7PXoB5lgwiBSpTty9RLe5maIQxnTk/edit?usp=sharing> > . > > Also, is there a reason we do not turn on the -Wshadow flag by default for > llvm builds? > > Thanks, > Mandeep > _______________________________________________ > cfe-dev mailing list > cfe-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200422/b14eaa6b/attachment.html>