[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:30 PDT 2025


================
@@ -27,6 +27,21 @@ namespace llvm {
   class Function;
 
 #if LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING
+#if LLVM_ENABLE_DEBUGLOC_ORIGIN_TRACKING
+  struct DbgLocOrigin {
+    static constexpr unsigned long MaxDepth = 16;
+    using StackTracesTy =
+        SmallVector<std::pair<int, std::array<void *, MaxDepth>>, 0>;
----------------
jmorse wrote:

Am I right in reading this as a 16-wide array stored in a vector that's either zero-lengthed or one (given that on initialization we add a single element to the vector)? I feel there must be a better pattern than storing an array in a vector -- a potentially empty unique_ptr to a std::array, and allocate the array off the heap when it's needed?

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


More information about the llvm-branch-commits mailing list