aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/Target/TargetData.h
diff options
context:
space:
mode:
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);