aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGClass.cpp
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2013-03-05 20:27:24 +0000
committerLang Hames <lhames@gmail.com>2013-03-05 20:27:24 +0000
commit23742cd8c6416c6c777904fb837b2021361c4f38 (patch)
treef6cbf2289f9aeca73ae75709313bec76cbfed563 /lib/CodeGen/CGClass.cpp
parent44f65a587ee39c20e715c9df411c864d328c71b5 (diff)
Use ASTContext::getDeclAlign(<Field Decl>) to get the alignment of the first
field to be memcpy'd, rather instead of ASTContext::getTypeAlign(<Field Type>). For packed structs the alignment of a field may be less than the alignment of the field's type. <rdar://problem/13338585> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176512 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGClass.cpp')
-rw-r--r--lib/CodeGen/CGClass.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/lib/CodeGen/CGClass.cpp b/lib/CodeGen/CGClass.cpp
index ac2dada083..4319e43b91 100644
--- a/lib/CodeGen/CGClass.cpp
+++ b/lib/CodeGen/CGClass.cpp
@@ -794,9 +794,7 @@ namespace {
const CGBitFieldInfo &BFInfo = RL.getBitFieldInfo(FirstField);
Alignment = CharUnits::fromQuantity(BFInfo.StorageAlignment);
} else {
- unsigned AlignBits =
- CGF.getContext().getTypeAlign(FirstField->getType());
- Alignment = CGF.getContext().toCharUnitsFromBits(AlignBits);
+ Alignment = CGF.getContext().getDeclAlign(FirstField);
}
assert((CGF.getContext().toCharUnitsFromBits(FirstFieldOffset) %