[llvm-commits] CVS: llvm/include/llvm/Analysis/DSNode.h DSSupport.h

Chris Lattner lattner at cs.uiuc.edu
Thu Jan 22 10:09:05 PST 2004


Changes in directory llvm/include/llvm/Analysis:

DSNode.h updated: 1.33 -> 1.34
DSSupport.h updated: 1.27 -> 1.28

---
Log message:

It doesn't make sense for one side to be const, but not the other.


---
Diffs of the changes:  (+10 -7)

Index: llvm/include/llvm/Analysis/DSNode.h
diff -u llvm/include/llvm/Analysis/DSNode.h:1.33 llvm/include/llvm/Analysis/DSNode.h:1.34
--- llvm/include/llvm/Analysis/DSNode.h:1.33	Tue Nov 11 16:41:30 2003
+++ llvm/include/llvm/Analysis/DSNode.h	Thu Jan 22 10:08:51 2004
@@ -326,7 +326,7 @@
   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 @@
 /// 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


Index: llvm/include/llvm/Analysis/DSSupport.h
diff -u llvm/include/llvm/Analysis/DSSupport.h:1.27 llvm/include/llvm/Analysis/DSSupport.h:1.28
--- llvm/include/llvm/Analysis/DSSupport.h:1.27	Thu Jan 22 09:26:15 2004
+++ llvm/include/llvm/Analysis/DSSupport.h	Thu Jan 22 10:08:51 2004
@@ -93,7 +93,7 @@
   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 @@
   /// 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;





More information about the llvm-commits mailing list