[llvm] [NFC][RemoveDIs] Add LocationType parameter to DPValue ctor (PR #74091)

via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 1 07:29:02 PST 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-debuginfo

@llvm/pr-subscribers-llvm-ir

Author: Orlando Cazalet-Hyams (OCHyams)

<details>
<summary>Changes</summary>

IMO we can tidy up the interfaces a bit once all intrinsics are supported, so we have a complete view.

---
Full diff: https://github.com/llvm/llvm-project/pull/74091.diff


2 Files Affected:

- (modified) llvm/include/llvm/IR/DebugProgramInstruction.h (+1-1) 
- (modified) llvm/lib/IR/DebugProgramInstruction.cpp (+2-3) 


``````````diff
diff --git a/llvm/include/llvm/IR/DebugProgramInstruction.h b/llvm/include/llvm/IR/DebugProgramInstruction.h
index cd5d37a078015be..7f16151cdfc64ba 100644
--- a/llvm/include/llvm/IR/DebugProgramInstruction.h
+++ b/llvm/include/llvm/IR/DebugProgramInstruction.h
@@ -113,7 +113,7 @@ class DPValue : public ilist_node<DPValue>, private DebugValueUser {
   /// Directly construct a new DPValue representing a dbg.value intrinsic
   /// assigning \p Location to the DV / Expr / DI variable.
   DPValue(Metadata *Location, DILocalVariable *DV, DIExpression *Expr,
-          const DILocation *DI);
+          const DILocation *DI, LocationType Type = LocationType::Value);
 
   /// Iterator for ValueAsMetadata that internally uses direct pointer iteration
   /// over either a ValueAsMetadata* or a ValueAsMetadata**, dereferencing to the
diff --git a/llvm/lib/IR/DebugProgramInstruction.cpp b/llvm/lib/IR/DebugProgramInstruction.cpp
index 6a4ee9d6101076f..df45c6ea3a776fd 100644
--- a/llvm/lib/IR/DebugProgramInstruction.cpp
+++ b/llvm/lib/IR/DebugProgramInstruction.cpp
@@ -35,10 +35,9 @@ DPValue::DPValue(const DPValue &DPV)
       DbgLoc(DPV.getDebugLoc()), Type(DPV.getType()) {}
 
 DPValue::DPValue(Metadata *Location, DILocalVariable *DV, DIExpression *Expr,
-                 const DILocation *DI)
+                 const DILocation *DI, LocationType Type)
     : DebugValueUser(Location), Variable(DV), Expression(Expr), DbgLoc(DI),
-      Type(LocationType::Value) {
-}
+      Type(Type) {}
 
 void DPValue::deleteInstr() { delete this; }
 

``````````

</details>


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


More information about the llvm-commits mailing list