[llvm-commits] CVS: llvm/include/llvm/Target/TargetData.h

Chris Lattner sabre at nondot.org
Sat Feb 10 11:55:47 PST 2007



Changes in directory llvm/include/llvm/Target:

TargetData.h updated: 1.49 -> 1.50
---
Log message:

Privatize StructLayout::MemberOffsets, adding an accessor


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

 TargetData.h |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)


Index: llvm/include/llvm/Target/TargetData.h
diff -u llvm/include/llvm/Target/TargetData.h:1.49 llvm/include/llvm/Target/TargetData.h:1.50
--- llvm/include/llvm/Target/TargetData.h:1.49	Sat Feb 10 13:33:15 2007
+++ llvm/include/llvm/Target/TargetData.h	Sat Feb 10 13:55:17 2007
@@ -275,16 +275,21 @@
 /// target machine, based on the TargetData structure.
 ///
 class StructLayout {
-public:
   std::vector<uint64_t> MemberOffsets;
-  uint64_t StructSize;
+public:
   unsigned StructAlignment;
+  uint64_t StructSize;
 
   /// getElementContainingOffset - Given a valid offset into the structure,
   /// return the structure index that contains it.
   ///
   unsigned getElementContainingOffset(uint64_t Offset) const;
 
+  uint64_t getElementOffset(unsigned Idx) const {
+    assert(Idx < MemberOffsets.size() && "Invalid element idx!");
+    return MemberOffsets[Idx];
+  }
+  
 private:
   friend class TargetData;   // Only TargetData can create this class
   StructLayout(const StructType *ST, const TargetData &TD);






More information about the llvm-commits mailing list