aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGObjCMac.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CodeGen/CGObjCMac.cpp')
-rw-r--r--lib/CodeGen/CGObjCMac.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp
index 1a1ef83123..1f58389ab8 100644
--- a/lib/CodeGen/CGObjCMac.cpp
+++ b/lib/CodeGen/CGObjCMac.cpp
@@ -4222,13 +4222,14 @@ void CGObjCNonFragileABIMac::GetClassSizeInfo(const ObjCImplementationDecl *OID,
const ASTRecordLayout &RL =
CGM.getContext().getASTObjCImplementationLayout(OID);
- if (!RL.getFieldCount()) {
- InstanceStart = InstanceSize = 0;
- return;
- }
-
- InstanceStart = RL.getFieldOffset(0) / 8;
+ // InstanceSize is really instance end.
InstanceSize = llvm::RoundUpToAlignment(RL.getNextOffset(), 8) / 8;
+
+ // If there are no fields, the start is the same as the end.
+ if (!RL.getFieldCount())
+ InstanceStart = InstanceSize;
+ else
+ InstanceStart = RL.getFieldOffset(0) / 8;
}
void CGObjCNonFragileABIMac::GenerateClass(const ObjCImplementationDecl *ID) {