[PATCH] D106431: [clang-tidy] Fix cppcoreguidelines-init-variables with enum judgement

liushuai wang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 21 04:59:41 PDT 2021


MTC added a comment.

In D106431#2892859 <https://reviews.llvm.org/D106431#2892859>, @whisperity wrote:

> Is this the right decision to make, conceptually? It will leave the variable uninitialised still, and reading such an uninit variable is still an issue, even if it is an enum.

Yeah, that's right. However, it's much more difficult to give enum an initial value than an integer.

> Could we consider the alternative of warning the user about the uninitialized variable, just not offering an automatic (and potentially bad / incorrect) fix?

Make sense, we (ByteDance) are also hesitating whether we should provide automatic repair for uninitialized variables, because automatic fix may change the program semantics.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106431



More information about the cfe-commits mailing list