diff options
| author | Douglas Gregor <dgregor@apple.com> | 2009-04-30 17:32:17 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2009-04-30 17:32:17 +0000 |
| commit | ef462e6bb0651f2a8b8df29134e43a59476522f8 (patch) | |
| tree | 1cd7003e0fb5935341bb80e6b826861848764e02 /clang/test/Sema/attr-aligned.c | |
| parent | f45e07d7663d4663472ff1ab64b41008ea10dbcd (diff) | |
| download | bcm5719-llvm-ef462e6bb0651f2a8b8df29134e43a59476522f8.tar.gz bcm5719-llvm-ef462e6bb0651f2a8b8df29134e43a59476522f8.zip | |
Properly compute the alignment of typedefs that make use of the
"aligned" attribute. Previously, we were skipping over these
attributes when we jumped directly to the canonical type. Now,
ASTContext::getTypeInfo walks through typedefs and other
"non-canonical" types manually, looking for "aligned" attributes on
typedefs.
As part of this change, I moved the GNU-specific logic (such as
determining the alignment of void or of a function pointer) out of the
expression evaluator and into ASTContext::getTypeInfo.
llvm-svn: 70497
Diffstat (limited to 'clang/test/Sema/attr-aligned.c')
| -rw-r--r-- | clang/test/Sema/attr-aligned.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/test/Sema/attr-aligned.c b/clang/test/Sema/attr-aligned.c index c7d65ee9ae8..6e641cb371f 100644 --- a/clang/test/Sema/attr-aligned.c +++ b/clang/test/Sema/attr-aligned.c @@ -5,3 +5,17 @@ int x __attribute__((aligned(3))); // expected-error {{requested alignment is no // PR3254 short g0[3] __attribute__((aligned)); short g0_chk[__alignof__(g0) == 16 ? 1 : -1]; + +// <rdar://problem/6840045> +typedef char ueber_aligned_char __attribute__((aligned(8))); + +struct struct_with_ueber_char { + ueber_aligned_char c; +}; + +char c = 0; + +char a0[__alignof__(ueber_aligned_char) == 8? 1 : -1] = { 0 }; +char a1[__alignof__(struct struct_with_ueber_char) == 8? 1 : -1] = { 0 }; +char a2[__alignof__(c) == 1? : -1] = { 0 }; +char a3[sizeof(c) == 1? : -1] = { 0 }; |

