diff options
author | Daniel Dunbar <daniel@zuster.org> | 2010-05-27 01:53:40 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2010-05-27 01:53:40 +0000 |
commit | 9f21f89c323ccf32f6b27acd2e739f6535440df0 (patch) | |
tree | c77e630c4fc0056f525a1f23ba939286aee44479 /lib/Sema/SemaDecl.cpp | |
parent | c76702cc80c1ef8a94d82b62ddcb4ed4f67d5b8c (diff) |
Sema: Replace getPragmaPackAlignment with AddAlignmentAttributesForRecord, which
exposes less details.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104797 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 9d87694a61..af020990dd 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -5397,11 +5397,9 @@ CreateNewDecl: Invalid = true; } - if (Kind != TTK_Enum) { - // Handle #pragma pack: if the #pragma pack stack has non-default - // alignment, make up a packed attribute for this decl. These - // attributes are checked when the ASTContext lays out the - // structure. + if (RecordDecl *RD = dyn_cast<RecordDecl>(New)) { + // Add alignment attributes if necessary; these attributes are checked when + // the ASTContext lays out the structure. // // It is important for implementing the correct semantics that this // happen here (in act on tag decl). The #pragma pack stack is @@ -5409,15 +5407,14 @@ CreateNewDecl: // many points during the parsing of a struct declaration (because // the #pragma tokens are effectively skipped over during the // parsing of the struct). - if (unsigned Alignment = getPragmaPackAlignment()) - New->addAttr(::new (Context) MaxFieldAlignmentAttr(Alignment * 8)); + AddAlignmentAttributesForRecord(RD); } // If this is a specialization of a member class (of a class template), // check the specialization. if (isExplicitSpecialization && CheckMemberSpecialization(New, Previous)) Invalid = true; - + if (Invalid) New->setInvalidDecl(); |