[llvm] [NFC] Change FindDbgDeclareUsers interface to match findDbgUsers/values (PR #73498)

Orlando Cazalet-Hyams via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 11 07:23:25 PST 2023


================
@@ -40,7 +40,7 @@ class Module;
 
 /// Finds dbg.declare intrinsics declaring local variables as living in the
 /// memory that 'V' points to.
-TinyPtrVector<DbgDeclareInst *> FindDbgDeclareUses(Value *V);
+void findDbgDeclares(SmallVectorImpl<DbgDeclareInst *> &DbgUsers, Value *V);
----------------
OCHyams wrote:

I agree that avoiding out-parameters would be ideal. 

I chose out-params here for consistency. findDbgValues has always had an out parameter and recent DPValue patches added a second one for DPValues. So it seemed better to follow suit with findDbgDeclares rather than have two different interfaces for similar functions.

> this could be accomplished with multiple functions

IMO that would make it easier for the old and new debug modes to diverge - having a single "find all debug-things" function seemed to make sense from that point of view.

One final point - we're in a bit of a transitionary stage. We would like to be able to completely remove debug intrinsics soon, at which point these functions go back to having a single "return value". Perhaps worth refactoring at that point?

I don't have a really strong opinion on this - I just wanted to show my working so far.


https://github.com/llvm/llvm-project/pull/73498


More information about the llvm-commits mailing list