[AIX] "aligned" attribute should not decrease type alignment returned by __alignof__
authorSteven Wan <wanyu9511@gmail.com>
Thu, 5 Aug 2021 22:18:48 +0000 (18:18 -0400)
committerSteven Wan <wanyu9511@gmail.com>
Thu, 5 Aug 2021 22:18:58 +0000 (18:18 -0400)
commita91916500d67155ca17bfdf3294541f871f90a45
treeb08179d912ab3cdc0ffa2ff49564f4ebdbe2d431
parent36498374d471272ab094b622dbc55874d8713a8f
[AIX] "aligned" attribute should not decrease type alignment returned by __alignof__

`__alignof__(x)` always returns `ABIAlign` if the "x" is marked `__attribute__((aligned()))`. However, the "aligned" attribute should only increase the alignment of a struct, or struct member, unless it's used together with the "packed" attribute, or used as a part of a typedef, in which case, the "aligned" attribute can both increase and decrease alignment.

Reviewed By: sfertile

Differential Revision: https://reviews.llvm.org/D107598
clang/lib/AST/ASTContext.cpp
clang/test/Layout/aix-alignof-align-and-pack-attr.cpp [new file with mode: 0644]