[cfe-commits] r76856 - /cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp
Anders Carlsson
andersca at mac.com
Wed Jul 22 21:59:24 PDT 2009
Author: andersca
Date: Wed Jul 22 23:59:05 2009
New Revision: 76856
URL: http://llvm.org/viewvc/llvm-project?rev=76856&view=rev
Log:
Set field info for unions.
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=76856&r1=76855&r2=76856&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp Wed Jul 22 23:59:05 2009
@@ -151,6 +151,7 @@
const ASTRecordLayout &Layout = Types.getContext().getASTRecordLayout(D);
+ const FieldDecl *FD = 0;
const llvm::Type *Ty = 0;
uint64_t Size = 0;
unsigned Align = 0;
@@ -182,12 +183,21 @@
Ty = FieldTy;
Align = FieldAlign;
Size = FieldSize;
+ FD = *Field;
}
}
// Now add our field.
- if (Ty)
+ if (FD) {
AppendField(0, Size, Ty);
+ Types.addFieldInfo(FD, 0);
+
+ if (FD->isBitField()) {
+ uint64_t FieldSize =
+ FD->getBitWidth()->EvaluateAsInt(Types.getContext()).getZExtValue();
+ Types.addBitFieldInfo(FD, 0, FieldSize);
+ }
+ }
// Append tail padding.
if (Layout.getSize() / 8 > Size)
More information about the cfe-commits
mailing list