Skip to content

Commit

Permalink
Revert "[NFC] Add checks for self-assignment."
Browse files Browse the repository at this point in the history
This reverts commit 8ac137a.

The code does not compile.
  • Loading branch information
mplatings committed Jul 24, 2023
1 parent 32e7d42 commit fa39c0a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 20 deletions.
12 changes: 5 additions & 7 deletions clang/lib/AST/APValue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
6 changes: 2 additions & 4 deletions clang/lib/CodeGen/CGDebugInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
17 changes: 8 additions & 9 deletions clang/lib/Interpreter/Value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit fa39c0a

Please sign in to comment.