[IR] Trivial cleanups in Use. NFC.

Remove Use::setPrev. It provided no value because it had the same
accessibility as the underlying field Prev, and there was no
corresponding setNext anyway.

Simplify Use::removeFromList.
This commit is contained in:
Jay Foad 2020-05-15 17:47:40 +01:00
parent dfb99e1a28
commit 91ef7cb508
3 changed files with 8 additions and 11 deletions

View File

@ -96,21 +96,18 @@ private:
Use **Prev = nullptr;
User *Parent = nullptr;
void setPrev(Use **NewPrev) { Prev = NewPrev; }
void addToList(Use **List) {
Next = *List;
if (Next)
Next->setPrev(&Next);
setPrev(List);
*List = this;
Next->Prev = &Next;
Prev = List;
*Prev = this;
}
void removeFromList() {
Use **StrippedPrev = Prev;
*StrippedPrev = Next;
*Prev = Next;
if (Next)
Next->setPrev(StrippedPrev);
Next->Prev = Prev;
}
};

View File

@ -837,7 +837,7 @@ template <class Compare> void Value::sortUseList(Compare Cmp) {
// Fix the Prev pointers.
for (Use *I = UseList, **Prev = &UseList; I; I = I->Next) {
I->setPrev(Prev);
I->Prev = Prev;
Prev = &I->Next;
}
}

View File

@ -831,12 +831,12 @@ void Value::reverseUseList() {
while (Current) {
Use *Next = Current->Next;
Current->Next = Head;
Head->setPrev(&Current->Next);
Head->Prev = &Current->Next;
Head = Current;
Current = Next;
}
UseList = Head;
Head->setPrev(&UseList);
Head->Prev = &UseList;
}
bool Value::isSwiftError() const {