[PATCH] D77168: Add a flag to debug automatic variable initialization
Jian Cai via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 28 16:13:19 PDT 2020
jcai19 marked an inline comment as done.
jcai19 added a comment.
> - Allows bracketing as John suggested (lower / upper bounds where to stop / start).
I have made some updates to this patch based on the comments here. One question I have though is whether we should have another option for starting point. Now that we implement the pragma support at https://reviews.llvm.org/D78693, bracketing can be done with pragma of uninitialized attribute. For bisection, we do not really need to specify a starting point. Not having it also means less change to the code path of automatic variable initialization, and therefore a less chance of introducing bugs.
================
Comment at: clang/lib/CodeGen/CGDecl.cpp:1814
+ if (StopAfter) {
+ static unsigned Counter = 0;
+ if (Counter >= StopAfter)
----------------
rjmccall wrote:
> jcai19 wrote:
> > rjmccall wrote:
> > > srhines wrote:
> > > > MaskRay wrote:
> > > > > I am a bit worried about the static variable. This makes CodeGen not reusable.
> > > > The counter could exist in ASTContext instead.
> > > IRGenModule would be the more appropriate place.
> > I can't seem to find IRGenModule. Do you mean CodeGenModule by any chance? Thanks.
> Yes, sorry. The Clang and Swift frontends use slightly different names for the same concept.
Thank you for the confirmation! Sorry I missed your reply earlier.
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