Author: Michael Platings Date: 2023-07-24T09:36:11+01:00 New Revision: fa39c0a58e87d9fb0751d4e65a77259a3ec53448
URL: https://github.com/llvm/llvm-project/commit/fa39c0a58e87d9fb0751d4e65a77259a3ec53448 DIFF: https://github.com/llvm/llvm-project/commit/fa39c0a58e87d9fb0751d4e65a77259a3ec53448.diff LOG: Revert "[NFC] Add checks for self-assignment." This reverts commit 8ac137acefc01caf636db5f95eb0977c97def1ba. The code does not compile. Added: Modified: clang/lib/AST/APValue.cpp clang/lib/CodeGen/CGDebugInfo.h clang/lib/Interpreter/Value.cpp Removed: ################################################################################ diff --git a/clang/lib/AST/APValue.cpp b/clang/lib/AST/APValue.cpp index 7bbde6d065316e..5b0a5e256e411a 100644 --- a/clang/lib/AST/APValue.cpp +++ b/clang/lib/AST/APValue.cpp @@ -390,13 +390,11 @@ APValue &APValue::operator=(const APValue &RHS) { } APValue &APValue::operator=(APValue &&RHS) { - if (this != RHS) { - if (Kind != None && Kind != Indeterminate) - DestroyDataAndMakeUninit(); - Kind = RHS.Kind; - Data = RHS.Data; - RHS.Kind = None; - } + if (Kind != None && Kind != Indeterminate) + DestroyDataAndMakeUninit(); + Kind = RHS.Kind; + Data = RHS.Data; + RHS.Kind = None; return *this; } diff --git a/clang/lib/CodeGen/CGDebugInfo.h b/clang/lib/CodeGen/CGDebugInfo.h index 5b089f3330c42b..58ee6dd64c4fc3 100644 --- a/clang/lib/CodeGen/CGDebugInfo.h +++ b/clang/lib/CodeGen/CGDebugInfo.h @@ -832,10 +832,8 @@ class ApplyDebugLocation { // Define copy assignment operator. ApplyDebugLocation &operator=(ApplyDebugLocation &&Other) { - if (this != Other) { - CGF = Other.CGF; - Other.CGF = nullptr; - } + CGF = Other.CGF; + Other.CGF = nullptr; return *this; } diff --git a/clang/lib/Interpreter/Value.cpp b/clang/lib/Interpreter/Value.cpp index 68adfc268261af..6d0eaf1b82e108 100644 --- a/clang/lib/Interpreter/Value.cpp +++ b/clang/lib/Interpreter/Value.cpp @@ -201,17 +201,16 @@ Value &Value::operator=(const Value &RHS) { } Value &Value::operator=(Value &&RHS) noexcept { - if (this != RHS) { - if (IsManuallyAlloc) - ValueStorage::getFromPayload(getPtr())->Release(); + if (IsManuallyAlloc) + ValueStorage::getFromPayload(getPtr())->Release(); - Interp = std::exchange(RHS.Interp, nullptr); - OpaqueType = std::exchange(RHS.OpaqueType, nullptr); - ValueKind = std::exchange(RHS.ValueKind, K_Unspecified); - IsManuallyAlloc = std::exchange(RHS.IsManuallyAlloc, false); + Interp = std::exchange(RHS.Interp, nullptr); + OpaqueType = std::exchange(RHS.OpaqueType, nullptr); + ValueKind = std::exchange(RHS.ValueKind, K_Unspecified); + IsManuallyAlloc = std::exchange(RHS.IsManuallyAlloc, false); + + Data = RHS.Data; - Data = RHS.Data; - } return *this; } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits