[llvm] [RemoveDIs][DebugInfo] Add DPVAssign variant of DPValue (PR #77912)

Jeremy Morse via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 15 02:58:42 PST 2024


================
@@ -152,26 +152,47 @@ DPValue *DebugValueUser::getUser() { return static_cast<DPValue *>(this); }
 const DPValue *DebugValueUser::getUser() const {
   return static_cast<const DPValue *>(this);
 }
-void DebugValueUser::handleChangedValue(Metadata *NewMD) {
-  getUser()->handleChangedLocation(NewMD);
+
+void DebugValueUser::handleChangedValue(void *Old, Metadata *New) {
+  // NOTE: We could inform the "owner" that a value has changed through
+  // getOwner, if needed.
+  auto OldMD = static_cast<Metadata **>(Old);
+  ptrdiff_t Idx = std::distance(DebugValues.begin(), OldMD);
+  resetDebugValue(Idx, New);
----------------
jmorse wrote:

Cool; IMO best to document this in a comment then, that it's expected to operate in this way.

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


More information about the llvm-commits mailing list