aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/Target/TargetData.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-02-10 19:55:17 +0000
committerChris Lattner <sabre@nondot.org>2007-02-10 19:55:17 +0000
commitb1919e2f08ecb37140af676fd2916f8d5ed7df3d (patch)
treec9373916caa20f1b69a6b4a5aa81c7c698c05d6f /include/llvm/Target/TargetData.h
parent68ce9ba666a7eb8c7eb3fb7888e4418fffd2e716 (diff)
Privatize StructLayout::MemberOffsets, adding an accessor
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34156 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Target/TargetData.h')
-rw-r--r--include/llvm/Target/TargetData.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/include/llvm/Target/TargetData.h b/include/llvm/Target/TargetData.h
index d577de7c8a..516aae700d 100644
--- a/include/llvm/Target/TargetData.h
+++ b/include/llvm/Target/TargetData.h
@@ -275,16 +275,21 @@ public:
/// 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);