aaron.ballman added a comment.

In D110656#3034971 <https://reviews.llvm.org/D110656#3034971>, @beanz wrote:

> In D110656#3034083 <https://reviews.llvm.org/D110656#3034083>, @xbolva00 
> wrote:
>
>> Why just no special case "= {0};" pattern and do not warn in that case?
>
> This case did show up, but was not the majority of issues for LLVM (although 
> might be the majority we care about). The related `= {nullptr};` pattern also 
> shows a few times.
>
>> If there are more patterns, take it from other side - pick patterns where 
>> you are sure that they are wrong and developer needs to fix them and emit 
>> warnings for them.
>
> There are a bunch of places (particularly in LLVM instruction matching), 
> where LLVM generates data structures with statically sized arrays that hold 
> the maximum possible values, and rely on zero-initialized values to denote 
> the end of the used space.
>
> For the tablegen-genreated code wrapping in `pragma`s to disable the warning 
> works, but there isn't really a good way that I can think of to not emit a 
> warning for an array of 10 elements where we provide 6 in a general case 
> while also warning on the actual potential bug.

This was the kind of thing I was worried about. I expect that this pattern also 
shows up (perhaps less frequently) in non-generated code as well.

> In D110656#3034149 <https://reviews.llvm.org/D110656#3034149>, @xbolva00 
> wrote:
>
>> If possible, @beanz could share list of new warnings from LLVM build here?
>
> The big offenders were the tablegen-generated asm and register matchers and 
> the target files under clang/lib/Basic/Targets. Those accounted for filling 
> my scroll back buffer a few times over...
>
> I'm running a new build now disabling the warning int he clang target files 
> to see how that shapes up. Will share what I find.

Thanks, I'm curious to hear what you find!

Another alternative to surfacing this as a frontend warning is to make a 
`bugprone` check for clang-tidy as the false positive rate seems likely to be 
more suited to that tool.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110656/new/

https://reviews.llvm.org/D110656

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to