Add assert for the case that is not handled.
struct { char a; short b:2; };
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43859 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/CodeGen/CodeGenTypes.cpp b/CodeGen/CodeGenTypes.cpp
index 30ef78f..5f040bb 100644
--- a/CodeGen/CodeGenTypes.cpp
+++ b/CodeGen/CodeGenTypes.cpp
@@ -399,7 +399,12 @@
assert (isBitField && "Invalid BitField size expression");
uint64_t BitFieldSize = FieldSize.getZExtValue();
if (ExtraBits == 0) {
+ const llvm::Type *PrevTy = LLVMFields.back();
const llvm::Type *Ty = CGT.ConvertType(FD->getType());
+ assert (CGT.getTargetData().getTypeSizeInBits(PrevTy) >=
+ CGT.getTargetData().getTypeSizeInBits(Ty)
+ && "FIXME Unable to handle bit field. Reuse last field");
+
// Calculate extra bits available in this bitfield.
ExtraBits = CGT.getTargetData().getTypeSizeInBits(Ty) - BitFieldSize;
addLLVMField(Ty, BitFieldSize, FD, 0, ExtraBits);