[PATCH] D150020: Fix possible self assign issue for DIEValue
Kan Shengchen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat May 6 01:56:38 PDT 2023
skan added inline comments.
================
Comment at: llvm/include/llvm/CodeGen/DIE.h:469
+ return *this;
destroyVal();
Ty = X.Ty;
----------------
https://stackoverflow.com/questions/12015156/what-is-wrong-with-checking-for-self-assignment-and-what-does-it-mean
Use copy-and-swap method?
```
DIEValue &operator=(DIEValue X) {
swap(*this, X);
return *this;
}
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D150020/new/
https://reviews.llvm.org/D150020
More information about the llvm-commits
mailing list