Skip to content

Commit edde45b

Browse files
committed
Guard against self-assignment; NFC
This was caught by a static analysis tool and seemed like a reasonable code quality improvement.
1 parent df79c40 commit edde45b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

clang/include/clang/AST/Type.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6410,9 +6410,11 @@ class SpirvOperand {
64106410
~SpirvOperand() {}
64116411

64126412
SpirvOperand &operator=(const SpirvOperand &Other) {
6413-
this->Kind = Other.Kind;
6414-
this->ResultType = Other.ResultType;
6415-
this->Value = Other.Value;
6413+
if (this != &Other) {
6414+
this->Kind = Other.Kind;
6415+
this->ResultType = Other.ResultType;
6416+
this->Value = Other.Value;
6417+
}
64166418
return *this;
64176419
}
64186420

0 commit comments

Comments
 (0)