Merge postfix attributes on record decls.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57019 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 315bf98..e1215a5 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -2112,7 +2112,7 @@
                        SourceLocation RecLoc, DeclTy *RecDecl,
                        DeclTy **Fields, unsigned NumFields,
                        SourceLocation LBrac, SourceLocation RBrac,
-                       AttributeList *Attrs) {
+                       AttributeList *Attr) {
   Decl *EnclosingDecl = static_cast<Decl*>(RecDecl);
   assert(EnclosingDecl && "missing record or interface decl");
   RecordDecl *Record = dyn_cast<RecordDecl>(EnclosingDecl);
@@ -2257,6 +2257,9 @@
       CheckImplementationIvars(IMPDecl, ClsFields, RecFields.size(), RBrac);
     }
   }
+
+  if (Attr)
+    ProcessDeclAttributeList(Record, Attr);
 }
 
 Sema::DeclTy *Sema::ActOnEnumConstant(Scope *S, DeclTy *theEnumDecl,
diff --git a/test/Sema/struct-packed-align.c b/test/Sema/struct-packed-align.c
index 6398cd3..8173f0f 100644
--- a/test/Sema/struct-packed-align.c
+++ b/test/Sema/struct-packed-align.c
@@ -89,3 +89,15 @@
 extern int k1[sizeof(union au6) == 4 ? 1 : -1];
 extern int k2[__alignof(union au6) == 2 ? 1 : -1];
 
+// Check postfix attributes
+union au7 {char c; int x;} __attribute__((packed));
+extern int l1[sizeof(union au7) == 4 ? 1 : -1];
+extern int l2[__alignof(union au7) == 1 ? 1 : -1];
+
+struct packed_fas2 {
+    char a;
+    int b[];
+} __attribute__((packed));
+
+extern int m1[sizeof(struct packed_fas2) == 1 ? 1 : -1];
+extern int m2[__alignof(struct packed_fas2) == 1 ? 1 : -1];