Commit Graph

3 Commits

Author SHA1 Message Date
Roger Ferrer Ibanez f7b9f3149b Add missing tests
Change r278483 was missing the tests

Differential Revision: https://reviews.llvm.org/D20561

llvm-svn: 278908
2016-08-17 06:52:15 +00:00
Roger Ferrer Ibanez 58b8e483f0 Reverting 275417
This change has triggered unexpected failures.

llvm-svn: 275462
2016-07-14 20:05:30 +00:00
Roger Ferrer Ibanez 585ea9ddce Diagnose taking address and reference binding of packed members
This patch implements PR#22821.

Taking the address of a packed member is dangerous since the reduced
alignment of the pointee is lost. This can lead to memory alignment
faults in some architectures if the pointer value is dereferenced.

This change adds a new warning to clang emitted when taking the address
of a packed member. A packed member is either a field/data member
declared as attribute((packed)) or belonging to a struct/class
declared as such. The associated flag is -Waddress-of-packed-member.
Conversions (either implicit or via a valid casting) to pointer types
with lower or equal alignment requirements (e.g. void* or char*)
silence the warning.

This change also adds a new error diagnostic when the user attempts to
bind a reference to a packed member, regardless of the alignment.

Differential Revision: https://reviews.llvm.org/D20561

llvm-svn: 275417
2016-07-14 14:10:43 +00:00