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

via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 26 03:58:59 PDT 2025


Author: Aaron Ballman
Date: 2025-06-26T06:58:56-04:00
New Revision: 95149011ea010a4b0ca0e9700437090ae582f8e5

URL: https://github.com/llvm/llvm-project/commit/95149011ea010a4b0ca0e9700437090ae582f8e5
DIFF: https://github.com/llvm/llvm-project/commit/95149011ea010a4b0ca0e9700437090ae582f8e5.diff

LOG: Guard against self-assignment; NFC (#145743)

This was caught by a static analysis tool and seemed like a reasonable
code quality improvement.

Added: 
    

Modified: 
    clang/include/clang/AST/Type.h

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h
index 24f3ae78e857b..1a87608e5be34 100644
--- a/clang/include/clang/AST/Type.h
+++ b/clang/include/clang/AST/Type.h
@@ -6409,12 +6409,7 @@ class SpirvOperand {
   SpirvOperand(const SpirvOperand &Other) { *this = Other; }
   ~SpirvOperand() {}
 
-  SpirvOperand &operator=(const SpirvOperand &Other) {
-    this->Kind = Other.Kind;
-    this->ResultType = Other.ResultType;
-    this->Value = Other.Value;
-    return *this;
-  }
+  SpirvOperand &operator=(const SpirvOperand &Other) = default;
 
   bool operator==(const SpirvOperand &Other) const {
     return Kind == Other.Kind && ResultType == Other.ResultType &&


        


More information about the cfe-commits mailing list