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.
Details
- Reviewers
skan pengfei - Commits
- rG77bc5cc658a3: Fix possible self assign issue for DIEValue
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/include/llvm/CodeGen/DIE.h | ||
---|---|---|
467 | Shouldn't we compare this with &X instead? |
llvm/include/llvm/CodeGen/DIE.h | ||
---|---|---|
469 | Use copy-and-swap method? DIEValue &operator=(DIEValue X) { swap(*this, X); return *this; } |
llvm/include/llvm/CodeGen/DIE.h | ||
---|---|---|
469 | This reported a lot of errors to me, I think swap will also call operator assign? When I read this code, another question occured to me, why do we need the explicit copy and assign constructor, this class don't maintain any dynamic memory. |
llvm/include/llvm/CodeGen/DIE.h | ||
---|---|---|
469 | Seems can pass check-all locally without copy and assign construction function. |
llvm/include/llvm/CodeGen/DIE.h | ||
---|---|---|
469 | swap does not call assignment operator, and it swaps the members of two classes. What's the error? |
llvm/include/llvm/CodeGen/DIE.h | ||
---|---|---|
469 | swap can not get a rvalue as parm. |
Shouldn't we compare this with &X instead?