Skip to content

Commit

Permalink
Fix possible self assign issue for DIEValue
Browse files Browse the repository at this point in the history
In DIEValue's operator assignment constructor, it didn't identify if
the two obj is the same.
I add code to identify them so that it will work correctly when we do
self assign here.

Reviewed By: skan

Differential Revision: https://reviews.llvm.org/D150020
  • Loading branch information
XinWang10 committed May 8, 2023
1 parent 651b0e2 commit 77bc5cc
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions llvm/include/llvm/CodeGen/DIE.h
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,8 @@ class DIEValue {
}

DIEValue &operator=(const DIEValue &X) {
if (this == &X)
return *this;
destroyVal();
Ty = X.Ty;
Attribute = X.Attribute;
Expand Down

0 comments on commit 77bc5cc

Please sign in to comment.