From: Devang Patel Date: Thu, 8 Nov 2007 00:32:12 +0000 (+0000) Subject: Add assert for the case that is not handled. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9b591f6f0d3e689bfb3a6cee6e64c9e95712f621;p=clang 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 30ef78f333..5f040bbb80 100644 --- a/CodeGen/CodeGenTypes.cpp +++ b/CodeGen/CodeGenTypes.cpp @@ -399,7 +399,12 @@ void RecordOrganizer::layoutStructFields(const ASTRecordLayout &RL) { 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);