diff options
author | Chris Lattner <sabre@nondot.org> | 2012-01-04 22:35:55 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2012-01-04 22:35:55 +0000 |
commit | 36bc4f41bcf46f5fa12238add36c40d14cf2b42e (patch) | |
tree | 9156d9ff5d5603f0eb3dddfbafed1b72485c7cfe /clang/lib/CodeGen | |
parent | cc0cf909538a7b387788f3a38286cae791db79ed (diff) | |
download | bcm5719-llvm-36bc4f41bcf46f5fa12238add36c40d14cf2b42e.tar.gz bcm5719-llvm-36bc4f41bcf46f5fa12238add36c40d14cf2b42e.zip |
implement rdar://10639962 by keeping track of increased alignment
information even in subscripting operations.
llvm-svn: 147557
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CGExpr.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp index 4c23c061a70..c6ba65c03c4 100644 --- a/clang/lib/CodeGen/CGExpr.cpp +++ b/clang/lib/CodeGen/CGExpr.cpp @@ -1702,13 +1702,17 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E) { assert(!T.isNull() && "CodeGenFunction::EmitArraySubscriptExpr(): Illegal base type"); + // Limit the alignment to that of the result type. + LValue LV; if (!ArrayAlignment.isZero()) { CharUnits Align = getContext().getTypeAlignInChars(T); ArrayAlignment = std::min(Align, ArrayAlignment); + LV = MakeAddrLValue(Address, T, ArrayAlignment); + } else { + LV = MakeNaturalAlignAddrLValue(Address, T); } - LValue LV = MakeAddrLValue(Address, T, ArrayAlignment); LV.getQuals().setAddressSpace(E->getBase()->getType().getAddressSpace()); if (getContext().getLangOptions().ObjC1 && |