diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-06-26 20:33:12 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-06-26 20:33:12 +0000 |
commit | ef915aab0ac566c55bfb0d7a9f6635bb5d94d4af (patch) | |
tree | ac935cfa19985d33098fc13e288b5ac830672dba /lib/CodeGen/SwiftCallingConv.cpp | |
parent | 325377b57338e700317f5e423e5b0f1c08d99a39 (diff) |
Notes
Diffstat (limited to 'lib/CodeGen/SwiftCallingConv.cpp')
-rw-r--r-- | lib/CodeGen/SwiftCallingConv.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/CodeGen/SwiftCallingConv.cpp b/lib/CodeGen/SwiftCallingConv.cpp index 0bfe30a32c806..fc8e36d2c5990 100644 --- a/lib/CodeGen/SwiftCallingConv.cpp +++ b/lib/CodeGen/SwiftCallingConv.cpp @@ -57,6 +57,10 @@ static CharUnits getTypeStoreSize(CodeGenModule &CGM, llvm::Type *type) { return CharUnits::fromQuantity(CGM.getDataLayout().getTypeStoreSize(type)); } +static CharUnits getTypeAllocSize(CodeGenModule &CGM, llvm::Type *type) { + return CharUnits::fromQuantity(CGM.getDataLayout().getTypeAllocSize(type)); +} + void SwiftAggLowering::addTypedData(QualType type, CharUnits begin) { // Deal with various aggregate types as special cases: @@ -542,7 +546,9 @@ SwiftAggLowering::getCoerceAndExpandTypes() const { packed = true; elts.push_back(entry.Type); - lastEnd = entry.End; + + lastEnd = entry.Begin + getTypeAllocSize(CGM, entry.Type); + assert(entry.End <= lastEnd); } // We don't need to adjust 'packed' to deal with possible tail padding |