Implement swapping

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4674 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2002-11-10 06:48:24 +00:00
parent a3590f2496
commit 5c533ae837
2 changed files with 30 additions and 0 deletions

View File

@ -271,4 +271,19 @@ inline void DSNodeHandle::mergeWith(const DSNodeHandle &Node) {
*this = Node;
}
inline void DSNodeHandle::swap(DSNodeHandle &NH) {
std::swap(Offset, NH.Offset);
if (N != NH.N) {
if (N) {
N->removeReferrer(this);
N->addReferrer(&NH);
}
if (NH.N) {
N->removeReferrer(&NH);
N->addReferrer(this);
}
std::swap(N, NH.N);
}
}
#endif

View File

@ -271,4 +271,19 @@ inline void DSNodeHandle::mergeWith(const DSNodeHandle &Node) {
*this = Node;
}
inline void DSNodeHandle::swap(DSNodeHandle &NH) {
std::swap(Offset, NH.Offset);
if (N != NH.N) {
if (N) {
N->removeReferrer(this);
N->addReferrer(&NH);
}
if (NH.N) {
N->removeReferrer(&NH);
N->addReferrer(this);
}
std::swap(N, NH.N);
}
}
#endif