This is an archive of the discontinued LLVM Phabricator instance.

Include unreferenced nested types in member list only for CodeView
ClosedPublic

Authored by amccarth on Jul 20 2016, 10:50 AM.

Details

Reviewers
dblaikie
rnk
Summary

Unreferenced nested structs and classes were omitted from the debug info. In DWARF, this was intentional, to avoid bloat. But, for CodeView, we want this information to be consistent with what Microsoft tools would produce and expect.

This is essentially my earlier patch with a switch to apply it only when generating CodeView.

Diff Detail

Event Timeline

amccarth updated this revision to Diff 64710.Jul 20 2016, 10:50 AM
amccarth retitled this revision from to Include unreferenced nested types in member list only for CodeView.
amccarth updated this object.
amccarth added reviewers: rnk, dblaikie.
amccarth added a subscriber: cfe-commits.
rnk added inline comments.Jul 20 2016, 11:04 AM
lib/CodeGen/CGDebugInfo.cpp
1096

Is getOrCreateMainFile correct here? I thought we'd use getOrCreateFile(RD->getLocation()), like this other code:

llvm::DIType *CGDebugInfo::getOrCreateRecordType(QualType RTy,
                                                 SourceLocation Loc) {
  assert(DebugKind >= codegenoptions::LimitedDebugInfo);
  llvm::DIType *T = getOrCreateType(RTy, getOrCreateFile(Loc));
  return T;
}
test/CodeGenCXX/debug-info-ms-abi.cpp
16

We should check what shows up in elements:, something like:

// CHECK-SAME: elements: ![[elements:[0-9]+]]

// CHECK: ![[elements]] = {![[f:[0-9]+]], ![[g:[0-9]+]], ![[h:[0-9]+]], ![[Nested:[0-9]+]]}

// CHECK: ![[Nested]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Nested",

And we can look for [[f]], g, and h, before the DISubprograms below.

amccarth updated this revision to Diff 64761.Jul 20 2016, 2:21 PM

Addressed feedback.

amccarth marked 2 inline comments as done.Jul 20 2016, 2:22 PM
rnk accepted this revision.Jul 20 2016, 2:44 PM
rnk edited edge metadata.

lgtm

This revision is now accepted and ready to land.Jul 20 2016, 2:44 PM
Eugene.Zelenko added a subscriber: Eugene.Zelenko.

Committed in r276271. Please specify Differential revision in commit message.