]> granicus.if.org Git - clang/commitdiff
Merge postfix attributes on record decls.
authorDaniel Dunbar <daniel@zuster.org>
Fri, 3 Oct 2008 17:33:35 +0000 (17:33 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Fri, 3 Oct 2008 17:33:35 +0000 (17:33 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57019 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDecl.cpp
test/Sema/struct-packed-align.c

index 315bf98af5af774a949dfe4099a1900118e3ecf3..e1215a5e9e4fa57f6e4cea05e49aaca96b483bf8 100644 (file)
@@ -2112,7 +2112,7 @@ void Sema::ActOnFields(Scope* S,
                        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 @@ void Sema::ActOnFields(Scope* S,
       CheckImplementationIvars(IMPDecl, ClsFields, RecFields.size(), RBrac);
     }
   }
+
+  if (Attr)
+    ProcessDeclAttributeList(Record, Attr);
 }
 
 Sema::DeclTy *Sema::ActOnEnumConstant(Scope *S, DeclTy *theEnumDecl,
index 6398cd3993c698ebb501a91e23f5d99cd21708e8..8173f0f2827271694d9145e6c4b50c010b1f2999 100644 (file)
@@ -89,3 +89,15 @@ union au6 {char c; __attribute__((packed, aligned(2))) int x;};
 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];