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

Stephen Tozer via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 12 13:20:29 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);
----------------
SLTozer wrote:

Do you mean duplicate metadata as-in, the same metadata appearing multiple times in this list? If so, the answer is that we ignore that here - this function should be called once for each pointer to the metadata being replaced that's being tracked anywhere, so if the pointer appears twice in here then they'll each have their own call even if the `Owner` is the same.

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


More information about the llvm-commits mailing list