summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/alignof.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [AST] Get aliased type info from an aliased TemplateSpecialization.Matt Davis2018-11-051-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: Previously the TemplateSpecialization instance for 'template_alias', in the example below, returned the type info of the canonical type (int). This ignored the type alias if the template type happen to be aliased. Before this patch, the assert would trigger with an alignment of 4: ``` typedef int __attribute__(( aligned( 16 ) )) aligned_int; template < typename > using template_alias = aligned_int; static_assert( alignof( template_alias<void>) == 16, "" ); ``` This patch checks if the TemplateSpecialization type has an alias, and if so will return the type information for the aliased type, else the canonical type's info is returned (original behavior). I believe that this is the desired behavior. Reviewers: aaron.ballman, rjmccall Reviewed By: rjmccall Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D54048 llvm-svn: 346146
* Fix test expectation to match reality.Richard Smith2018-10-261-3/+3
| | | | llvm-svn: 345423
* PR26547: alignof should return ABI alignment, not preferred alignmentRichard Smith2018-10-261-10/+10
| | | | | | | | | | | | Summary: - Add `UETT_PreferredAlignOf` to account for the difference between `__alignof` and `alignof` - `AlignOfType` now returns ABI alignment instead of preferred alignment iff clang-abi-compat > 7, and one uses _Alignof or alignof Patch by Nicole Mazzuca! Differential Revision: https://reviews.llvm.org/D53207 llvm-svn: 345419
* [Sema] Don't permit dependent alignments on non-dependent typedef-namesDavid Majnemer2015-04-071-0/+13
| | | | | | | | | | | | | | | | | A dependent alignment attribute (like __attribute__((aligned(...))) or __declspec(align(...))) on a non-dependent typedef or using declaration poses a considerable challenge: the type is _not_ dependent, the size _may_ be dependent if the type is used as an array type, the alignment _is_ dependent. It is reasonable for a compiler to be able to query the size and alignment of a complete type. Let's help that become an invariant. This fixes PR22042. Differential Revision: http://reviews.llvm.org/D8693 llvm-svn: 234280
* AST: alignof might be dependent because of alignment attributesDavid Majnemer2015-01-151-0/+7
| | | | | | | Dependent alignment attributes should make an alignof expression dependent as well. llvm-svn: 226156
* Related to PR19992: when the GNU alignof-expression extension is applied to anRichard Smith2014-06-101-3/+12
| | | | | | | expression of array-of-unknown-bound type, don't try to complete the array bound, and return the alignment of the element type rather than 1. llvm-svn: 210608
* PR19992: alignof is permitted on an array of unknown bound.Richard Smith2014-06-101-0/+6
| | | | llvm-svn: 210585
* Fix alignof computation of large arrays on x86_64.Rafael Espindola2013-08-081-0/+4
| | | | | | | | | | | We were exposing the extra alignment given to large arrays. The new behavior matches gcc, which is a good thing since this is a gcc extension. Thanks to Joerg Sonnenberger for noticing it. While at it, centralize the method description in the .h file. llvm-svn: 187999
* Don't try to get the layout of an invalid decl in getDeclAlign.Matt Beaumont-Gay2013-06-251-1/+9
| | | | | | | | | | | When the decl that we're getting alignment for is a FieldDecl, and the field's parent record is invalid, skip the actual field alignment calculation (and return 1-byte alignment in the general case). Also, assert in in getASTRecordLayout that the decl is valid. This was inspired by PR16292; see also r184581 and r184751. llvm-svn: 184883
* Require the containing type to be complete when we seeJohn McCall2013-05-061-0/+52
__alignof__ of a field. This problem can only happen in C++11. Also do some petty optimizations. rdar://13784901 llvm-svn: 181185
OpenPOWER on IntegriCloud