[llvm] 77bc5cc - Fix possible self assign issue for DIEValue
via llvm-commits
llvm-commits at lists.llvm.org
Mon May 8 02:56:06 PDT 2023
Author: Wang, Xin10
Date: 2023-05-08T05:55:39-04:00
New Revision: 77bc5cc658a3b57a1fffbcb0490988ce7047d5b9
URL: https://github.com/llvm/llvm-project/commit/77bc5cc658a3b57a1fffbcb0490988ce7047d5b9
DIFF: https://github.com/llvm/llvm-project/commit/77bc5cc658a3b57a1fffbcb0490988ce7047d5b9.diff
LOG: Fix possible self assign issue for DIEValue
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
Added:
Modified:
llvm/include/llvm/CodeGen/DIE.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/CodeGen/DIE.h b/llvm/include/llvm/CodeGen/DIE.h
index a598e0ae0688..c2450f9418bb 100644
--- a/llvm/include/llvm/CodeGen/DIE.h
+++ b/llvm/include/llvm/CodeGen/DIE.h
@@ -464,6 +464,8 @@ class DIEValue {
}
DIEValue &operator=(const DIEValue &X) {
+ if (this == &X)
+ return *this;
destroyVal();
Ty = X.Ty;
Attribute = X.Attribute;
More information about the llvm-commits
mailing list