Take #pragma pack into account when laying out structs. Fixes rdar://problem/7095436.
llvm-svn: 78490
diff --git a/clang/lib/CodeGen/CGRecordLayoutBuilder.h b/clang/lib/CodeGen/CGRecordLayoutBuilder.h
index bca0b5c..ff551a4 100644
--- a/clang/lib/CodeGen/CGRecordLayoutBuilder.h
+++ b/clang/lib/CodeGen/CGRecordLayoutBuilder.h
@@ -36,6 +36,9 @@
/// Packed - Whether the resulting LLVM struct will be packed or not.
bool Packed;
+ /// Alignment - Contains the alignment of the RecordDecl.
+ unsigned Alignment;
+
/// AlignmentAsLLVMStruct - Will contain the maximum alignment of all the
/// LLVM types.
unsigned AlignmentAsLLVMStruct;
@@ -69,7 +72,7 @@
llvm::SmallVector<LLVMBitFieldInfo, 16> LLVMBitFields;
CGRecordLayoutBuilder(CodeGenTypes &Types)
- : Types(Types), Packed(false), AlignmentAsLLVMStruct(1)
+ : Types(Types), Packed(false), Alignment(0), AlignmentAsLLVMStruct(1)
, BitsAvailableInLastField(0), NextFieldOffsetInBytes(0) { }
/// Layout - Will layout a RecordDecl.