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

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 31 19:50:44 PDT 2020


rjmccall added a comment.

I can understand the automation benefits of just counting the number of variables initialized so far in the translation unit without having to modify source, but if you can possibly do this with the pragma, that seems like both a more flexible tool (you can isolate multiple variables) and one that will produce more easily-interpretable results.  For example, won't you need some way of figuring out what the 1,134th variable in a file was after you've successfully bisected?



================
Comment at: clang/lib/CodeGen/CGDecl.cpp:1814
+    if (StopAfter) {
+      static unsigned Counter = 0;
+      if (Counter >= StopAfter)
----------------
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.


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