[PATCH] D148692: Fix uninitialized class members

Sergei Barannikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 12 12:46:59 PDT 2023


barannikov88 added a comment.

I think it is more the static analyzer issue that it is not able to figure out that
the entry point of the class is not its constructor, but runOnMachineFunction,
which initializes most (or all) member variables before using them.

> Not everything has invalid values.

This is a really good point. Initializing all fields to some default values will make
it more difficult to add a new filed that does not have an obvious default.
Even in this patch some time has been spent discussing what's the best default
value for a particular variable, and I've seen more of such discussions in other
similar patches. That just wastes people's time without any benefit for human.

Finally, I don't remember any of the recent patches caught a real bug.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D148692



More information about the llvm-commits mailing list