aboutsummaryrefslogtreecommitdiff
path: root/CodeGen/CodeGenTypes.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2007-11-08 00:32:12 +0000
committerDevang Patel <dpatel@apple.com>2007-11-08 00:32:12 +0000
commit9b591f6f0d3e689bfb3a6cee6e64c9e95712f621 (patch)
tree24b2c386f0ad9df4442892f44186d0b04b9f1e1b /CodeGen/CodeGenTypes.cpp
parent1049436d4b53d928b555f7381bc1639dd302bbc7 (diff)
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
Diffstat (limited to 'CodeGen/CodeGenTypes.cpp')
-rw-r--r--CodeGen/CodeGenTypes.cpp5
1 files changed, 5 insertions, 0 deletions
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);