summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2010-04-17 22:54:57 +0000
committerAnders Carlsson <andersca@mac.com>2010-04-17 22:54:57 +0000
commitd5f27b058348b6ac35e11ced236b91c4e2148a45 (patch)
tree2cf763a6e935424f4477d2202c4d61f687a992f2 /clang/lib
parent5ab116553171e67015f63178a3927de22400e3da (diff)
downloadbcm5719-llvm-d5f27b058348b6ac35e11ced236b91c4e2148a45.tar.gz
bcm5719-llvm-d5f27b058348b6ac35e11ced236b91c4e2148a45.zip
Simplify wide bit-field layout in CGRecordLayoutBuilder, and also fix a bug where assigning to a bit-field member would overwrite other parts of the struct.
llvm-svn: 101681
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/CodeGen/CGRecordLayoutBuilder.cpp25
1 files changed, 10 insertions, 15 deletions
diff --git a/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp b/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp
index 215b39e7432..71dca504c59 100644
--- a/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp
+++ b/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp
@@ -161,21 +161,16 @@ static CGBitFieldInfo ComputeBitFieldInfo(CodeGenTypes &Types,
bool IsSigned = FD->getType()->isSignedIntegerType();
if (FieldSize > TypeSizeInBits) {
- // We have a wide bit-field.
-
- CGBitFieldInfo::AccessInfo Component;
-
- Component.FieldIndex = 0;
- Component.FieldByteOffset =
- TypeSizeInBytes * ((FieldOffset / 8) / TypeSizeInBytes);
- Component.FieldBitStart = 0;
- Component.AccessWidth = TypeSizeInBits;
- // FIXME: This might be wrong!
- Component.AccessAlignment = 0;
- Component.TargetBitOffset = 0;
- Component.TargetBitWidth = TypeSizeInBits;
-
- return CGBitFieldInfo(TypeSizeInBits, 1, &Component, IsSigned);
+ // We have a wide bit-field. The extra bits are only used for padding, so
+ // if we have a bitfield of type T, with size N:
+ //
+ // T t : N;
+ //
+ // We can just assume that it's:
+ //
+ // T t : sizeof(T);
+ //
+ FieldSize = TypeSizeInBits;
}
unsigned StartBit = FieldOffset % TypeSizeInBits;
OpenPOWER on IntegriCloud