[clang] [llvm] [DLCov 2/5] Implement DebugLoc coverage tracking (PR #107279)

Stephen Tozer via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 26 07:37:14 PDT 2024


================
@@ -22,6 +23,67 @@ namespace llvm {
   class LLVMContext;
   class raw_ostream;
   class DILocation;
+  class Function;
+
+#if ENABLE_DEBUGLOC_COVERAGE_TRACKING
+  // Used to represent different "kinds" of DebugLoc, expressing that a DebugLoc
+  // is either ordinary, containing a valid DILocation, or otherwise describing
+  // the reason why the DebugLoc does not contain a valid DILocation.
+  enum class DebugLocKind : uint8_t {
+    // DebugLoc is expected to contain a valid DILocation.
+    Normal,
+    // DebugLoc intentionally does not have a valid DILocation; may be for a
+    // compiler-generated instruction, or an explicitly dropped location.
+    LineZero,
----------------
SLTozer wrote:

Decided to tackle this by just splitting this straight into two categories - `CompilerGenerated` and `Dropped` - that each more specifically describe the reason for the empty DebugLoc. This more closely aligns with the original plans, which I'd veered off from because there wasn't any technical purpose to distinguishing the two cases, but I think having clear and meaningful names is enough reason!

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


More information about the cfe-commits mailing list