[PATCH] D143984: [DebugMetadata] Simplify handling subprogram's retainedNodes field. NFCI (1/7)

Juan Manuel Martinez CaamaƱo via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 23 04:36:39 PST 2023


jmmartinez added inline comments.


================
Comment at: llvm/lib/IR/DIBuilder.cpp:789
+  return createLocalVariable(
+      VMContext, getSubprogramNodesTrackingVector(Scope), Scope, Name,
+      /* ArgNo */ 0, File, LineNo, Ty, AlwaysPreserve, Flags, AlignInBits);
----------------
krisb wrote:
> jmmartinez wrote:
> > I'll be tempted to move the call to `getSubprogramNodesTrackingVector(Scope)` into `createLocalVariable`. It seems that every time `createLocalVariable` is called, `getSubprogramNodesTrackingVector(Scope)` is passed as value for `PreservedNodes`.
> > 
> > (I've just started reviewing so I may be missing some other modifications)
> That's right, but the problem is in the fact that `createLocalVariable()` is static while `getSubprogramNodesTrackingVector()` is a DIBuilder's member. To move the call inside `createLocalVariable()` we need either to make it a member of DIBuilder or to pass DIBuilder object to it. None of these options looks much better to me, honestly. 
You're right. I didn't realize createLocalVariable was not a member of DIBuilder.

Ok for me to keep it as it .


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D143984



More information about the llvm-commits mailing list