[PATCH] D150020: [draft]Fix possible self assign for DIEValue

Wang, Xin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat May 6 00:04:46 PDT 2023


XinWang10 created this revision.
Herald added a project: All.
XinWang10 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D150020

Files:
  llvm/include/llvm/CodeGen/DIE.h


Index: llvm/include/llvm/CodeGen/DIE.h
===================================================================
--- llvm/include/llvm/CodeGen/DIE.h
+++ llvm/include/llvm/CodeGen/DIE.h
@@ -464,6 +464,8 @@
   }
 
   DIEValue &operator=(const DIEValue &X) {
+    if (&Val == &X.Val)
+      return *this;
     destroyVal();
     Ty = X.Ty;
     Attribute = X.Attribute;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150020.520037.patch
Type: text/x-patch
Size: 361 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230506/e5bc6c61/attachment.bin>


More information about the llvm-commits mailing list