Introduce a new PragmaPack attribute, and use it for #pragma pack. The PackedAttr now only represents __attribute__((packed)).

This is necessary because #pragma pack and __attribute__((packed)) have different semantics. No functionality change yet, but this lays the groundwork for fixing a record layout bug.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78483 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGRecordLayoutBuilder.cpp b/lib/CodeGen/CGRecordLayoutBuilder.cpp
index a119d4f..d3699bb 100644
--- a/lib/CodeGen/CGRecordLayoutBuilder.cpp
+++ b/lib/CodeGen/CGRecordLayoutBuilder.cpp
@@ -31,9 +31,8 @@
     LayoutUnion(D);
     return;
   }
-  
-  if (const PackedAttr* PA = D->getAttr<PackedAttr>())
-    Packed = PA->getAlignment();
+
+  Packed = D->hasAttr<PackedAttr>();
 
   if (LayoutFields(D))
     return;
@@ -96,15 +95,8 @@
 
 bool CGRecordLayoutBuilder::LayoutField(const FieldDecl *D,
                                         uint64_t FieldOffset) {
-  bool FieldPacked = Packed;
-  
-  // FIXME: Should this override struct packing? Probably we want to
-  // take the minimum?
-  if (const PackedAttr *PA = D->getAttr<PackedAttr>())
-    FieldPacked = PA->getAlignment();
-
   // If the field is packed, then we need a packed struct.
-  if (!Packed && FieldPacked)
+  if (!Packed && D->hasAttr<PackedAttr>())
     return false;
 
   if (D->isBitField()) {