diff options
| author | Chris Lattner <sabre@nondot.org> | 2002-11-10 06:48:24 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2002-11-10 06:48:24 +0000 |
| commit | 5c533ae837a2101e620a4e2f06acaa35f16e5fa7 (patch) | |
| tree | 199fca6eef4413c1e2c41b7d898d4d2ed82abfa4 /include/llvm/Analysis | |
| parent | a3590f2496c5d57b0150d43a0d4bd00b5eb344ed (diff) | |
Implement swapping
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4674 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Analysis')
| -rw-r--r-- | include/llvm/Analysis/DSNode.h | 15 | ||||
| -rw-r--r-- | include/llvm/Analysis/DataStructure/DSNode.h | 15 |
2 files changed, 30 insertions, 0 deletions
diff --git a/include/llvm/Analysis/DSNode.h b/include/llvm/Analysis/DSNode.h index 7726d72f37..64748d85b6 100644 --- a/include/llvm/Analysis/DSNode.h +++ b/include/llvm/Analysis/DSNode.h @@ -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 diff --git a/include/llvm/Analysis/DataStructure/DSNode.h b/include/llvm/Analysis/DataStructure/DSNode.h index 7726d72f37..64748d85b6 100644 --- a/include/llvm/Analysis/DataStructure/DSNode.h +++ b/include/llvm/Analysis/DataStructure/DSNode.h @@ -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 |
