[cfe-commits] r57019 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/Sema/struct-packed-align.c

Daniel Dunbar daniel at zuster.org
Fri Oct 3 10:33:35 PDT 2008


Author: ddunbar
Date: Fri Oct  3 12:33:35 2008
New Revision: 57019

URL: http://llvm.org/viewvc/llvm-project?rev=57019&view=rev
Log:
Merge postfix attributes on record decls.

Modified:
    cfe/trunk/lib/Sema/SemaDecl.cpp
    cfe/trunk/test/Sema/struct-packed-align.c

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=57019&r1=57018&r2=57019&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Fri Oct  3 12:33:35 2008
@@ -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,

Modified: cfe/trunk/test/Sema/struct-packed-align.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/struct-packed-align.c?rev=57019&r1=57018&r2=57019&view=diff

==============================================================================
--- cfe/trunk/test/Sema/struct-packed-align.c (original)
+++ cfe/trunk/test/Sema/struct-packed-align.c Fri Oct  3 12:33:35 2008
@@ -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];





More information about the cfe-commits mailing list