[cfe-commits] r76907 - /cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp
Anders Carlsson
andersca at mac.com
Thu Jul 23 15:52:50 PDT 2009
Author: andersca
Date: Thu Jul 23 17:52:34 2009
New Revision: 76907
URL: http://llvm.org/viewvc/llvm-project?rev=76907&view=rev
Log:
Don't just store the field/bit field info one field, do it for all fields in the union.
Modified:
cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp
Modified: cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp?rev=76907&r1=76906&r2=76907&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp Thu Jul 23 17:52:34 2009
@@ -146,7 +146,6 @@
const ASTRecordLayout &Layout = Types.getContext().getASTRecordLayout(D);
- const FieldDecl *FD = 0;
const llvm::Type *Ty = 0;
uint64_t Size = 0;
unsigned Align = 0;
@@ -164,7 +163,11 @@
// Ignore zero sized bit fields.
if (FieldSize == 0)
continue;
- }
+
+ // Add the bit field info.
+ Types.addBitFieldInfo(*Field, 0, 0, FieldSize);
+ } else
+ Types.addFieldInfo(*Field, 0);
const llvm::Type *FieldTy =
Types.ConvertTypeForMemRecursive(Field->getType());
@@ -178,21 +181,12 @@
Ty = FieldTy;
Align = FieldAlign;
Size = FieldSize;
- FD = *Field;
}
}
// Now add our field.
- if (FD) {
+ if (Ty)
AppendField(0, Size, Ty);
-
- if (FD->isBitField()) {
- uint64_t FieldSize =
- FD->getBitWidth()->EvaluateAsInt(Types.getContext()).getZExtValue();
- Types.addBitFieldInfo(FD, 0, 0, FieldSize);
- } else
- Types.addFieldInfo(FD, 0);
- }
// Append tail padding.
if (Layout.getSize() / 8 > Size)
More information about the cfe-commits
mailing list