diff options
| author | Fariborz Jahanian <fjahanian@apple.com> | 2011-04-28 22:49:46 +0000 |
|---|---|---|
| committer | Fariborz Jahanian <fjahanian@apple.com> | 2011-04-28 22:49:46 +0000 |
| commit | 8409bce4aca162fad81e43f84cece1b9b13cde77 (patch) | |
| tree | 941fdab26edf4c880baf6e51154bfa84af91fa26 /clang/lib/CodeGen/CGExprConstant.cpp | |
| parent | 80d1d3aaecb5eb086cd568114716d20bcf40c793 (diff) | |
| download | bcm5719-llvm-8409bce4aca162fad81e43f84cece1b9b13cde77.tar.gz bcm5719-llvm-8409bce4aca162fad81e43f84cece1b9b13cde77.zip | |
ms_struct patch for initialization and field access irgen.
// rdar://8823265 - wip.
llvm-svn: 130451
Diffstat (limited to 'clang/lib/CodeGen/CGExprConstant.cpp')
| -rw-r--r-- | clang/lib/CodeGen/CGExprConstant.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGExprConstant.cpp b/clang/lib/CodeGen/CGExprConstant.cpp index 338fb03b8a0..8054d4b0372 100644 --- a/clang/lib/CodeGen/CGExprConstant.cpp +++ b/clang/lib/CodeGen/CGExprConstant.cpp @@ -344,16 +344,30 @@ bool ConstStructBuilder::Build(InitListExpr *ILE) { unsigned FieldNo = 0; unsigned ElementNo = 0; + const FieldDecl *LastFD = 0; + bool IsMsStruct = RD->hasAttr<MsStructAttr>(); + for (RecordDecl::field_iterator Field = RD->field_begin(), FieldEnd = RD->field_end(); Field != FieldEnd; ++Field, ++FieldNo) { + if (IsMsStruct) { + // Zero-length bitfields following non-bitfield members are + // ignored: + if (CGM.getContext().ZeroBitfieldFollowsNonBitfield((*Field), LastFD)) { + --FieldNo; + continue; + } + LastFD = (*Field); + } // If this is a union, skip all the fields that aren't being initialized. if (RD->isUnion() && ILE->getInitializedFieldInUnion() != *Field) continue; // Don't emit anonymous bitfields, they just affect layout. - if (Field->isBitField() && !Field->getIdentifier()) + if (Field->isBitField() && !Field->getIdentifier()) { + LastFD = (*Field); continue; + } // Get the initializer. A struct can include fields without initializers, // we just use explicit null values for them. |

