summaryrefslogtreecommitdiffstats
path: root/clang/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
commit224ae88bc3f3c0ad43a50da048a2f789898a18cf (patch)
tree4ad34a59cae2828e593260e17c5d2fb4f3b01fb2 /clang/lib/CodeGen/CGClass.cpp
parent37f2ab4824ec3309ee3b578efc2839cdf4ce2a24 (diff)
downloadbcm5719-llvm-224ae88bc3f3c0ad43a50da048a2f789898a18cf.tar.gz
bcm5719-llvm-224ae88bc3f3c0ad43a50da048a2f789898a18cf.zip
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> llvm-svn: 176512
Diffstat (limited to 'clang/lib/CodeGen/CGClass.cpp')
-rw-r--r--clang/lib/CodeGen/CGClass.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGClass.cpp b/clang/lib/CodeGen/CGClass.cpp
index ac2dada0834..4319e43b91b 100644
--- a/clang/lib/CodeGen/CGClass.cpp
+++ b/clang/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) %
OpenPOWER on IntegriCloud