[llvm-branch-commits] [llvm-gcc-branch] r69526 - /llvm-gcc-4.2/branches/Apple/Dib/gcc/llvm-convert.cpp
Bill Wendling
isanbard at gmail.com
Sun Apr 19 01:05:42 PDT 2009
Author: void
Date: Sun Apr 19 03:05:38 2009
New Revision: 69526
URL: http://llvm.org/viewvc/llvm-project?rev=69526&view=rev
Log:
--- Merging (from foreign repository) r69514 into '.':
U gcc/llvm-convert.cpp
GCC's FOR_EACH_CONSTRUCTOR_ELT macro skips over anonymous
bitfield members. Handle random spacing added by them in
the struct by adding zero bytes.
Modified:
llvm-gcc-4.2/branches/Apple/Dib/gcc/llvm-convert.cpp
Modified: llvm-gcc-4.2/branches/Apple/Dib/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Dib/gcc/llvm-convert.cpp?rev=69526&r1=69525&r2=69526&view=diff
==============================================================================
--- llvm-gcc-4.2/branches/Apple/Dib/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/branches/Apple/Dib/gcc/llvm-convert.cpp Sun Apr 19 03:05:38 2009
@@ -6932,6 +6932,14 @@
/// AddFieldToRecordConstant.
void ConstantLayoutInfo::
AddBitFieldToRecordConstant(ConstantInt *ValC, uint64_t GCCFieldOffsetInBits) {
+ // If the GCC field starts after our current LLVM field then there must have
+ // been an anonymous bitfield or other thing that shoved it over. No matter,
+ // just insert some i8 padding until there are bits to fill in.
+ while (GCCFieldOffsetInBits > NextFieldByteStart*8) {
+ ResultElts.push_back(ConstantInt::get(Type::Int8Ty, 0));
+ ++NextFieldByteStart;
+ }
+
// If the field is a bitfield, it could partially go in a previously
// laid out structure member, and may add elements to the end of the currently
// laid out structure.
@@ -7009,9 +7017,6 @@
GCCFieldOffsetInBits = NextFieldByteStart*8;
}
- assert(GCCFieldOffsetInBits == NextFieldByteStart*8 &&
- "expected no missing bitfields");
-
APInt Val = ValC->getValue();
// Okay, we know that we're plopping bytes onto the end of the struct.
More information about the llvm-branch-commits
mailing list