Page MenuHomePhabricator

Generalize FindTypes with CompilerContext to support fuzzy lookup

Authored by aprantl on Aug 20 2019, 4:43 PM.



This patch generalizes the FindTypes with CompilerContext interface to support looking up a type of unknown kind by name, as well as looking up a type inside an unspecified submodule. These features are motivated by the Swift branch, but are fully tested via unit tests and lldb-test on
Specifically, this patch adds an AnyModule and an AnyType CompilerContext kind.

Diff Detail


Event Timeline

aprantl created this revision.Aug 20 2019, 4:43 PM

I don't have any context or opinion on the high level functionality, but can we please not use inheritance in this way? Though I have done similar things in the past, I am not really proud of them. It looks like the matching code can be just as easily be implemented as a free function...

54–60 ↗(On Diff #216289)

it looks like you should use context_chain.end() instead of end().
Also, all of this probably boils down to it = std::find_if(it, context_chain.end(), [](??? cc) { return cc.kind != Module; });

aprantl updated this revision to Diff 216425.Aug 21 2019, 10:04 AM

Address feedback from Pavel.

JDevlieghere accepted this revision.Aug 21 2019, 10:31 AM


42 ↗(On Diff #216425)

nit: reflow

This revision is now accepted and ready to land.Aug 21 2019, 10:31 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptAug 21 2019, 11:06 AM