This is an archive of the discontinued LLVM Phabricator instance.

Emit CodeView type records for nested classes
ClosedPublic

Authored by amccarth on Jul 1 2016, 2:19 PM.

Details

Summary

This is the final step in getting nested classes/structs into the type records in CodeView. Includes a simple test.

https://llvm.org/bugs/show_bug.cgi?id=28152

Diff Detail

Repository
rL LLVM

Event Timeline

amccarth updated this revision to Diff 62544.Jul 1 2016, 2:19 PM
amccarth retitled this revision from to Emit CodeView type records for nested classes.
amccarth updated this object.
amccarth added a reviewer: rnk.
amccarth added a subscriber: llvm-commits.
rnk added inline comments.Jul 1 2016, 2:50 PM
lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
1568 ↗(On Diff #62544)

This should probably be Fields.writeNestedType(getTypeIndex(Nested)). The idea is that you should always be able to call getTypeIndex, and if that happens to reference a complete record type, we defer its emission until some time later. getTypeIndex also maintains the map from DINode* to TypeIndex, and directly calling the lower* methods bypasses that.

I should write comments in CodeViewDebug.h about this!

test/DebugInfo/COFF/types-nested-class.ll
28 ↗(On Diff #62544)

We should see a NestedType record in A's FieldList. Right now both A and A::Nested are empty, so they share the same field list. :)

rnk edited edge metadata.Jul 1 2016, 2:53 PM

Oh, you should also set ClassOptions::ContainsNestedClass if the nested type list is non-empty.

We should also set ClassOptions::Nested if the scope of a class is a DICompositeType.

amccarth added inline comments.Jul 1 2016, 3:44 PM
test/DebugInfo/COFF/types-nested-class.ll
28 ↗(On Diff #62544)

OK, that surprises me, but OK. I wouldn't have expected a type in the field list.

amccarth updated this revision to Diff 62555.Jul 1 2016, 3:46 PM
amccarth edited edge metadata.

Now includes the nested type in the field list (and includes it in the member count).

rnk accepted this revision.Jul 1 2016, 3:49 PM
rnk edited edge metadata.

lgtm

test/DebugInfo/COFF/types-nested-class.ll
28 ↗(On Diff #62544)

Yeah, I would've called it "member" list, but I was trying to stay closer to their terminology.

This revision is now accepted and ready to land.Jul 1 2016, 3:49 PM
amccarth updated this revision to Diff 62563.Jul 1 2016, 4:04 PM
amccarth edited edge metadata.

Sets the ContainsNestedClass property when appropriate.

This revision was automatically updated to reflect the committed changes.