This is an archive of the discontinued LLVM Phabricator instance.

Fix codegen for virtual methods that are (re-) exported from multiple modules.
ClosedPublic

Authored by klimek on Feb 23 2015, 7:46 AM.

Details

Reviewers
rsmith
Summary

Fixes multiple crashes where a non-canonical decl would be used as
key.

Diff Detail

Event Timeline

klimek updated this revision to Diff 20511.Feb 23 2015, 7:46 AM
klimek retitled this revision from to Fix codegen for virtual methods that are (re-) exported from multiple modules..
klimek updated this object.
klimek edited the test plan for this revision. (Show Details)
klimek added a reviewer: rsmith.
klimek added a subscriber: Unknown Object (MLST).

There's (at least) one more getCanonicalDecl() missing; working on a test.

klimek updated this revision to Diff 20516.Feb 23 2015, 8:21 AM

Attack the problem on a higher level; adapted test to catch more problems.

rsmith accepted this revision.Feb 23 2015, 4:22 PM
rsmith edited edge metadata.

I'm curious how this was failing -- all four places you changed appear to be walking over the method declarations that are lexically within the class definitions, so they should all see the same set of declarations. Is there some other source of map keys that uses the canonical declaration instead? In any case, using the canonical declaration as the key seems like a good idea.

Is there any reason not to put all the module definitions in the same module map file in your test case? The use directives also seem redundant, since this isn't a test of -fmodules-decluse.

This revision is now accepted and ready to land.Feb 23 2015, 4:22 PM
klimek updated this revision to Diff 20570.Feb 24 2015, 12:41 AM
klimek edited edge metadata.

Simplify module map.

klimek updated this revision to Diff 20571.Feb 24 2015, 12:48 AM

Delete old module maps.

I'm curious how this was failing -- all four places you changed appear to be walking over the method declarations that are lexically within the class definitions, so they should all see the same set of declarations. Is there some other source of map keys that uses the canonical declaration instead? In any case, using the canonical declaration as the key seems like a good idea.

Most of the code already uses the canonical decls. When we create the OverridersMap / MethodInfoMap we apparently already use the canonical decl as key. The problem is that when we walk over the methods of a class owned by one module ('b' in this test), we might hit methods whose canonical decl is the method from the other module ('c' in this case).

Is there any reason not to put all the module definitions in the same module map file in your test case? The use directives also seem redundant, since this isn't a test of -fmodules-decluse.

Done. Was just the way I was used to seeing module maps :)

klimek closed this revision.Jul 2 2015, 6:48 AM