]> granicus.if.org Git - clang/commit
AST: Don't ignore alignas on EnumDecls when calculating alignment
authorDavid Majnemer <david.majnemer@gmail.com>
Wed, 21 Jan 2015 10:54:38 +0000 (10:54 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Wed, 21 Jan 2015 10:54:38 +0000 (10:54 +0000)
commitc9301cf73af73b45ae89b5f8e63c97462dec082f
tree840897a103983090c8938777c2ce4929f0301029
parent9ec272cccdab5fb0d614161a20a45baeb67679aa
AST: Don't ignore alignas on EnumDecls when calculating alignment

We didn't consider any alignment attributes on an EnumDecl when
calculating alignment.

While we are here, ignore alignment specifications on typedef types if
one is used as the underlying type.  Otherwise, weird things happen:

enum Y : int;
Y y;

typedef int __attribute__((aligned(64))) u;
enum Y : u {};

What is the alignment of 'Y'?  It would be more consistent with the
overall design of enums with fixed underlying types to consider the
underlying type's UnqualifiedDesugaredType.

This fixes PR22279.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@226653 91177308-0d34-0410-b5e6-96231b3b80d8
lib/AST/ASTContext.cpp
lib/Sema/SemaDeclAttr.cpp
test/CXX/dcl.dcl/dcl.attr/dcl.align/p5.cpp
test/Sema/align-x86.c