Page MenuHomePhabricator

[Orc] Allow LLJITBuilder's CreateObjectLinkingLayer to return errors

Authored by sgraenitz on Jan 14 2021, 7:37 AM.



It can be useful for an ObjectLinkingLayerCreator to allow callee errors to get propagated to the builder. Specifically, this is the case when the ObjectLayer uses the EHFrameRegistrationPlugin, because it requires a TPCEHFrameRegistrar and instantiation for it may fail (e.g. if the required registration symbols are missing in the target process).

Diff Detail

Event Timeline

sgraenitz created this revision.Jan 14 2021, 7:37 AM
sgraenitz requested review of this revision.Jan 14 2021, 7:37 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 14 2021, 7:37 AM
lhames added inline comments.Jan 14 2021, 12:52 PM
48 ↗(On Diff #316658)

Rather than pass an Error by reference here, could you change ObjectLinkingLayerCreator's signature to return an Expected<std::unique_ptr<ObjectLayer>> ?

sgraenitz marked an inline comment as done.Jan 14 2021, 12:55 PM
sgraenitz added inline comments.
48 ↗(On Diff #316658)

Yes good point. I will make an update.

sgraenitz updated this revision to Diff 316764.Jan 14 2021, 1:18 PM
sgraenitz marked an inline comment as done.

Drop the Error output parameter and return an Expected instead

sgraenitz retitled this revision from [Orc] Allow errors via output parameter in LLJITBuilder's CreateObjectLinkingLayer to [Orc] Allow LLJITBuilder's CreateObjectLinkingLayer to return errors.Jan 14 2021, 1:19 PM
lhames accepted this revision.Jan 14 2021, 1:26 PM

Great. Thanks very much Stefan!

This revision is now accepted and ready to land.Jan 14 2021, 1:26 PM
This revision was landed with ongoing or failed builds.Jan 15 2021, 3:54 AM
This revision was automatically updated to reflect the committed changes.