[PATCH] D77168: Add a flag to debug automatic variable initialization

Petr Hosek via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 20 16:50:33 PDT 2020


phosek added a comment.

We've rolled out `-ftrivial-auto-var-init=pattern` to all of Fuchsia several months ago. In my experience, having the `pragma` would have been really valuable during the rollout stage when we've often commented out portion of code while narrowing down the issue, which is basically a strawman version of the `pragma`. Similarly, the variable byte pattern would have also been a great timesaver.

I don't think we ever had a use case for the proposed flag, which doesn't mean that it's not useful, but I don't know how to use it effectively. Specifically, every time I was debugging an uninitialized variable issue, I'd know which file and often even which portion of the file the bug is in. In our build, we always apply flags to the entire target, not individual files, so to use the proposed flag, I'd have to modify the build to extract a single file into a separate target in order to apply the flag only to that file which seems comparatively intrusive to inserting the `pragma`. Is that something you could comment on? Do you have an existing experience of using this flag in your build? What's your strategy for using it?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77168





More information about the cfe-commits mailing list