This is an archive of the discontinued LLVM Phabricator instance.

Fix bug in getCompleteTypeIndex in codeview debug info
ClosedPublic

Authored by akhuang on May 2 2019, 1:39 PM.

Details

Diff Detail

Repository
rL LLVM

Event Timeline

akhuang created this revision.May 2 2019, 1:39 PM
rnk added a comment.May 2 2019, 1:47 PM

This should have a test. I think you can use this C++ to start:

struct Foo;
extern "C" __declspec(allocator) Foo *alloc_foo();
void escape(Foo*);
void doit() {
  escape(alloc_foo());
  escape(alloc_foo());
  escape(alloc_foo());
}

Before this change, the symbols would show the wrong type for the second and third heap alloc sites.

llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
2519–2521 ↗(On Diff #197855)

While we're here, please simplify this to just use .find since we can't use InsertResult below.

2536–2539 ↗(On Diff #197855)

If you do delete InsertResult, you should simplify this comment to just say that we need to re-do the hash lookup because complete type lowering may insert more complete types into the table.

akhuang updated this revision to Diff 197865.May 2 2019, 2:16 PM
akhuang marked an inline comment as done.
  • Add comment about inserting type to map
llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
2519–2521 ↗(On Diff #197855)

Not inserting breaks in the case of circular references

rnk added a comment.May 2 2019, 2:33 PM
In D61460#1488547, @rnk wrote:

This should have a test.

Still needs a test, did you forget to add it when making the diff?

akhuang updated this revision to Diff 197891.May 2 2019, 4:31 PM
  • Add case with multiple heapallocsites to test

I modified the existing test a bit to add the multiple heapallocsites case.

rnk accepted this revision.May 2 2019, 5:31 PM

lgtm

This revision is now accepted and ready to land.May 2 2019, 5:31 PM
This revision was automatically updated to reflect the committed changes.