[llvm-branch-commits] [llvm] [DLCov] Origin-Tracking: Collect stack traces in DebugLoc (PR #143592)

Jeremy Morse via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Jun 16 06:30:29 PDT 2025


================
@@ -55,22 +70,29 @@ namespace llvm {
     Temporary
   };
 
-  // Extends TrackingMDNodeRef to also store a DebugLocKind, allowing Debugify
-  // to ignore intentionally-empty DebugLocs.
-  class DILocAndCoverageTracking : public TrackingMDNodeRef {
+  // Extends TrackingMDNodeRef to also store a DebugLocKind and Origin,
+  // allowing Debugify to ignore intentionally-empty DebugLocs and display the
+  // code responsible for generating unintentionally-empty DebugLocs.
+  // Currently we only need to track the Origin of this DILoc when using a
+  // DebugLoc that is not annotated (i.e. has DebugLocKind::Normal) and has a
+  // null DILocation, so only collect the origin stacktrace in those cases.
+  class DILocAndCoverageTracking : public TrackingMDNodeRef,
+                                   public DbgLocOrigin {
----------------
jmorse wrote:

A reflex inside my head says "prefer composition to inheritance" -- is there a reason we need to inherit from DbgLocOrigin, instead of having it as a named member of `DILocAndCoverageTracking`?

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


More information about the llvm-branch-commits mailing list