diff options
author | John McCall <rjmccall@apple.com> | 2013-05-07 05:20:46 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2013-05-07 05:20:46 +0000 |
commit | 6054d5aa7b35a4d2274fd999acfb499d9f796789 (patch) | |
tree | 4e4c518762702897693b616ff3ae563f0930075d /clang/lib/CodeGen/CGClass.cpp | |
parent | 790ede43decb29c2938d342cae663cd64b1fb557 (diff) | |
download | bcm5719-llvm-6054d5aa7b35a4d2274fd999acfb499d9f796789.tar.gz bcm5719-llvm-6054d5aa7b35a4d2274fd999acfb499d9f796789.zip |
Weaken an assertion in memcpyization to account for
unnamed bitfields.
Unnamed bitfields won't have an explicit copy operation
in the AST, which breaks the strong form of the invariant.
rdar://13816940
llvm-svn: 181289
Diffstat (limited to 'clang/lib/CodeGen/CGClass.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGClass.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGClass.cpp b/clang/lib/CodeGen/CGClass.cpp index 3fd075701d0..e4180a0d72d 100644 --- a/clang/lib/CodeGen/CGClass.cpp +++ b/clang/lib/CodeGen/CGClass.cpp @@ -859,8 +859,12 @@ namespace { } void addNextField(FieldDecl *F) { - assert(F->getFieldIndex() == LastAddedFieldIndex + 1 && - "Cannot aggregate non-contiguous fields."); + // For the most part, the following invariant will hold: + // F->getFieldIndex() == LastAddedFieldIndex + 1 + // The one exception is that Sema won't add a copy-initializer for an + // unnamed bitfield, which will show up here as a gap in the sequence. + assert(F->getFieldIndex() >= LastAddedFieldIndex + 1 && + "Cannot aggregate fields out of order."); LastAddedFieldIndex = F->getFieldIndex(); // The 'first' and 'last' fields are chosen by offset, rather than field |