forked from OSchip/llvm-project
[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:
parent
dfb99e1a28
commit
91ef7cb508
|
@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue