[clang] Guard against self-assignment; NFC (PR #145743)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 25 10:32:29 PDT 2025


================
@@ -6410,9 +6410,11 @@ class SpirvOperand {
   ~SpirvOperand() {}
 
   SpirvOperand &operator=(const SpirvOperand &Other) {
-    this->Kind = Other.Kind;
-    this->ResultType = Other.ResultType;
-    this->Value = Other.Value;
+    if (this != &Other) {
----------------
erichkeane wrote:

I mean... I guess?  The copy below is unbelievably cheap except for maybe ap-int.  I DO find myself wondering why this (and operator==) isnt just `= default`  though.  Could we try that instead? 

https://github.com/llvm/llvm-project/pull/145743


More information about the cfe-commits mailing list