diff options
author | Chris Lattner <sabre@nondot.org> | 2004-01-22 16:08:51 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-01-22 16:08:51 +0000 |
commit | 9a37f2d96a195e0b7f28605e8b642d04c9cc30ca (patch) | |
tree | d40ae2f29e308e23ccc82107e278ffefdee8563a /include | |
parent | 4c6cb7a2b1fca93742a7751640375854bca762ae (diff) | |
download | llvm-9a37f2d96a195e0b7f28605e8b642d04c9cc30ca.tar.gz llvm-9a37f2d96a195e0b7f28605e8b642d04c9cc30ca.tar.bz2 llvm-9a37f2d96a195e0b7f28605e8b642d04c9cc30ca.tar.xz |
It doesn't make sense for one side to be const, but not the other.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10952 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Analysis/DSNode.h | 13 | ||||
-rw-r--r-- | include/llvm/Analysis/DSSupport.h | 4 | ||||
-rw-r--r-- | include/llvm/Analysis/DataStructure/DSNode.h | 13 | ||||
-rw-r--r-- | include/llvm/Analysis/DataStructure/DSSupport.h | 4 |
4 files changed, 20 insertions, 14 deletions
diff --git a/include/llvm/Analysis/DSNode.h b/include/llvm/Analysis/DSNode.h index f206c3e5ad..1008789046 100644 --- a/include/llvm/Analysis/DSNode.h +++ b/include/llvm/Analysis/DSNode.h @@ -326,7 +326,7 @@ inline DSNode *DSNodeHandle::getNode() const { return HandleForwarding(); } -inline void DSNodeHandle::setNode(DSNode *n) { +inline void DSNodeHandle::setNode(DSNode *n) const { assert(!n || !n->getForwardNode() && "Cannot set node to a forwarded node!"); if (N) N->NumReferrers--; N = n; @@ -377,11 +377,14 @@ inline void DSNodeHandle::addEdgeTo(unsigned Off, const DSNodeHandle &Node) { /// mergeWith - Merge the logical node pointed to by 'this' with the node /// pointed to by 'N'. /// -inline void DSNodeHandle::mergeWith(const DSNodeHandle &Node) { - if (N != 0) +inline void DSNodeHandle::mergeWith(const DSNodeHandle &Node) const { + if (!isNull()) getNode()->mergeWith(Node, Offset); - else // No node to merge with, so just point to Node - *this = Node; + else { // No node to merge with, so just point to Node + Offset = 0; + setNode(Node.getNode()); + Offset = Node.getOffset(); + } } } // End llvm namespace diff --git a/include/llvm/Analysis/DSSupport.h b/include/llvm/Analysis/DSSupport.h index 15d948f897..da8afa5a87 100644 --- a/include/llvm/Analysis/DSSupport.h +++ b/include/llvm/Analysis/DSSupport.h @@ -93,7 +93,7 @@ public: inline DSNode *getNode() const; // Defined inline in DSNode.h unsigned getOffset() const { return Offset; } - inline void setNode(DSNode *N); // Defined inline in DSNode.h + inline void setNode(DSNode *N) const; // Defined inline in DSNode.h void setOffset(unsigned O) { //assert((!N || Offset < N->Size || (N->Size == 0 && Offset == 0) || // !N->ForwardNH.isNull()) && "Node handle offset out of range!"); @@ -108,7 +108,7 @@ public: /// mergeWith - Merge the logical node pointed to by 'this' with the node /// pointed to by 'N'. /// - void mergeWith(const DSNodeHandle &N); + void mergeWith(const DSNodeHandle &N) const; // hasLink - Return true if there is a link at the specified offset... inline bool hasLink(unsigned Num) const; diff --git a/include/llvm/Analysis/DataStructure/DSNode.h b/include/llvm/Analysis/DataStructure/DSNode.h index f206c3e5ad..1008789046 100644 --- a/include/llvm/Analysis/DataStructure/DSNode.h +++ b/include/llvm/Analysis/DataStructure/DSNode.h @@ -326,7 +326,7 @@ inline DSNode *DSNodeHandle::getNode() const { return HandleForwarding(); } -inline void DSNodeHandle::setNode(DSNode *n) { +inline void DSNodeHandle::setNode(DSNode *n) const { assert(!n || !n->getForwardNode() && "Cannot set node to a forwarded node!"); if (N) N->NumReferrers--; N = n; @@ -377,11 +377,14 @@ inline void DSNodeHandle::addEdgeTo(unsigned Off, const DSNodeHandle &Node) { /// mergeWith - Merge the logical node pointed to by 'this' with the node /// pointed to by 'N'. /// -inline void DSNodeHandle::mergeWith(const DSNodeHandle &Node) { - if (N != 0) +inline void DSNodeHandle::mergeWith(const DSNodeHandle &Node) const { + if (!isNull()) getNode()->mergeWith(Node, Offset); - else // No node to merge with, so just point to Node - *this = Node; + else { // No node to merge with, so just point to Node + Offset = 0; + setNode(Node.getNode()); + Offset = Node.getOffset(); + } } } // End llvm namespace diff --git a/include/llvm/Analysis/DataStructure/DSSupport.h b/include/llvm/Analysis/DataStructure/DSSupport.h index 15d948f897..da8afa5a87 100644 --- a/include/llvm/Analysis/DataStructure/DSSupport.h +++ b/include/llvm/Analysis/DataStructure/DSSupport.h @@ -93,7 +93,7 @@ public: inline DSNode *getNode() const; // Defined inline in DSNode.h unsigned getOffset() const { return Offset; } - inline void setNode(DSNode *N); // Defined inline in DSNode.h + inline void setNode(DSNode *N) const; // Defined inline in DSNode.h void setOffset(unsigned O) { //assert((!N || Offset < N->Size || (N->Size == 0 && Offset == 0) || // !N->ForwardNH.isNull()) && "Node handle offset out of range!"); @@ -108,7 +108,7 @@ public: /// mergeWith - Merge the logical node pointed to by 'this' with the node /// pointed to by 'N'. /// - void mergeWith(const DSNodeHandle &N); + void mergeWith(const DSNodeHandle &N) const; // hasLink - Return true if there is a link at the specified offset... inline bool hasLink(unsigned Num) const; |