This makes the range loop warnings part of -Wall.
This 'fixes' https://bugs.llvm.org/show_bug.cgi?id=32823
Differential D68912
Adds -Wrange-loop-analysis to -Wall Mordante on Oct 12 2019, 8:53 AM. Authored by
Details This makes the range loop warnings part of -Wall. This 'fixes' https://bugs.llvm.org/show_bug.cgi?id=32823
Diff Detail
Event TimelineComment Actions Does this analysis require CFG support or have a high false positive rate? We typically keep those out of -Wall because of performance concerns, so I am wondering if the diagnostic was kept out of -Wall for a reason. Comment Actions
https://reviews.llvm.org/D69292 also requires CFG support. Generally, is CFG support ok for -Wall if the warning has few false positives?
Yes, it would be good to find why this was disabled (never enabled?). @Mordante can you compile LLVM itself with this patch? Comment Actions Yes, it does.
I think it also depends on the performance of the diagnostic.
I'd be curious to know how the timing changes between compilations as well; does this regress performance considerably? Comment Actions I don't know, @rtrieu originally added the warnings, maybe he can answer that question.
I compiled LLVM and Clang and it adds 145 unique warnings. I wouldn't mind to fix those and the other subprojects, so I can test whether the tests have false positives.
I did a partial build of LLVM the timings are quite similar: Before: After: Comment Actions
Can you upload the list with new warnings somewhere? How many false positives? I dont think you have to fix them as a prerequisite - buildbots do not use -Werror. Comment Actions I haven't reviewed the list [1] properly so I don't know the number of false positives yet. Comment Actions I spot-checked the list and definitely saw some true positives in there. I did not exhaustively check the list, however. The timing numbers look reasonable enough as well. Unless someone finds an issue with the fp rate that I've missed, I think this is reasonable. Comment Actions Thanks for the review. I also looked at some of the new warnings and I'm preparing patches to fix them. Comment Actions Thanks. I'll first want to reduce the number of warnings before committing this patch. Comment Actions Oh, I hit this (-Werror bots) hard :D Some bots use -Werror. So when build is warning-free, then please commit this patch. Comment Actions I will, a bit busy at the moment but will look at fixing the warnings before committing. Comment Actions Not yet :-( Comment Actions We are hitting the warning in template code with bool and loop like this: "for (const auto& element : value)" where element is bool from template. But not always. However, the template type can also use non-bools and if I remove the reference I hit alternative case where the warning complains about copy operation of reference types: So there is no way to satisfy the warning other than disabling it. Comment Actions Thanks for your report. I think it's similar to https://bugs.llvm.org/show_bug.cgi?id=44556. I'll look for a fix. |