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

Chris Lattner lattner at cs.uiuc.edu
Fri Oct 18 13:23:00 PDT 2002


Changes in directory llvm/include/llvm/Analysis:

DSGraph.h updated: 1.8 -> 1.9

---
Log message:

Convert typerec to be a structure instead of a pair


---
Diffs of the changes:

Index: llvm/include/llvm/Analysis/DSGraph.h
diff -u llvm/include/llvm/Analysis/DSGraph.h:1.8 llvm/include/llvm/Analysis/DSGraph.h:1.9
--- llvm/include/llvm/Analysis/DSGraph.h:1.8	Thu Oct 17 16:03:49 2002
+++ llvm/include/llvm/Analysis/DSGraph.h	Fri Oct 18 13:22:44 2002
@@ -120,7 +120,23 @@
   /// different types can be represented by this single DSNode.  This vector is
   /// kept sorted.
   ///
-  typedef std::pair<const Type *, unsigned> TypeRec;
+  struct TypeRec {
+    const Type *Ty;
+    unsigned Offset;
+
+    TypeRec() : Ty(0), Offset(0) {}
+    TypeRec(const Type *T, unsigned O) : Ty(T), Offset(O) {}
+
+    bool operator<(const TypeRec &TR) const {
+      // Sort first by offset!
+      return Offset < TR.Offset || (Offset == TR.Offset && Ty < TR.Ty);
+    }
+    bool operator==(const TypeRec &TR) const {
+      return Ty == TR.Ty && Offset == TR.Offset;
+    }
+    bool operator!=(const TypeRec &TR) const { return !operator==(TR); }
+  };
+
   std::vector<TypeRec> TypeEntries;
 
   /// Globals - The list of global values that are merged into this node.





More information about the llvm-commits mailing list