diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2011-04-28 23:43:23 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2011-04-28 23:43:23 +0000 |
commit | 6d003c3041e2325ea30ff95306467ff3829addca (patch) | |
tree | 239d226669d74d7527b2cd3237a2a56c43b71b43 /clang/lib/CodeGen/CGDebugInfo.cpp | |
parent | 6cd4d1d85ac0040a19c4e554e66bbd245860dcae (diff) | |
download | bcm5719-llvm-6d003c3041e2325ea30ff95306467ff3829addca.tar.gz bcm5719-llvm-6d003c3041e2325ea30ff95306467ff3829addca.zip |
Fixes debug info generation problem for ms_struct structs.
// rdar://8823265
llvm-svn: 130458
Diffstat (limited to 'clang/lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 11a0fac2ea5..4b2b9085169 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -618,18 +618,31 @@ void CGDebugInfo:: CollectRecordFields(const RecordDecl *record, llvm::DIFile tunit, llvm::SmallVectorImpl<llvm::Value *> &elements) { unsigned fieldNo = 0; + const FieldDecl *LastFD = 0; + bool IsMsStruct = record->hasAttr<MsStructAttr>(); + const ASTRecordLayout &layout = CGM.getContext().getASTRecordLayout(record); for (RecordDecl::field_iterator I = record->field_begin(), E = record->field_end(); I != E; ++I, ++fieldNo) { FieldDecl *field = *I; + if (IsMsStruct) { + // Zero-length bitfields following non-bitfield members are ignored + if (CGM.getContext().ZeroBitfieldFollowsNonBitfield((field), LastFD)) { + --fieldNo; + continue; + } + LastFD = field; + } llvm::StringRef name = field->getName(); QualType type = field->getType(); // Ignore unnamed fields unless they're anonymous structs/unions. - if (name.empty() && !type->isRecordType()) + if (name.empty() && !type->isRecordType()) { + LastFD = field; continue; + } llvm::DIType fieldType = createFieldType(name, type, field->getBitWidth(), |