[PATCH] D77168: Add a flag to debug automatic variable initialization
Stephen Hines via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 31 18:12:52 PDT 2020
srhines added a comment.
In D77168#1953635 <https://reviews.llvm.org/D77168#1953635>, @jfb wrote:
> I'm not sure this is a good idea at all. We want to keep the codepath as simple as possible to avoid introducing bugs. If a codebase sees a crash then it's easier to bisect one function at a time than doing something like this. I'd much rather see bisection using pragma to apply the `uninitialized` attribute to multiple declarations.
Certainly one function at a time is preferable, but that's not always possible. I do think that this would be a useful feature for making bisection easier, since automating the injection of `pragma`s into code seems a lot more challenging. Of course, the `pragma` approach is nice for other reasons (letting people carve out entire functions for initialized/uninitialized, but I think that is orthogonal to the debugging aspect.
================
Comment at: clang/lib/CodeGen/CGDecl.cpp:1814
+ if (StopAfter) {
+ static unsigned Counter = 0;
+ if (Counter >= StopAfter)
----------------
MaskRay wrote:
> I am a bit worried about the static variable. This makes CodeGen not reusable.
The counter could exist in ASTContext instead.
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