Page MenuHomePhabricator

[libc++] Properly handle errors happening during Lit configuration
ClosedPublic

Authored by ldionne on Tue, Nov 16, 9:40 AM.

Details

Summary

Instead of silently swallowing errors that happen during Lit configuration
(for example trying to obtain compiler macros but compiling fails), raise
an exception with some amount of helpful information.

This should avoid the possibility of silently configuring Lit in a bogus
way, and also provides more helpful information when things fail.

Diff Detail

Event Timeline

ldionne created this revision.Tue, Nov 16, 9:40 AM
ldionne requested review of this revision.Tue, Nov 16, 9:40 AM
Herald added a project: Restricted Project. · View Herald TranscriptTue, Nov 16, 9:40 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
Mordante accepted this revision as: Mordante.Tue, Nov 16, 9:54 AM

Thanks a lot. I just tested the patch locally on a branch where I had modular build issues. With this patch it again was easy to solve these issues!
LGTM.

ldionne updated this revision to Diff 388630.Fri, Nov 19, 2:33 PM

Fix the dsl tests.

Quuxplusone accepted this revision as: Quuxplusone.Fri, Nov 19, 2:35 PM
Quuxplusone added a subscriber: Quuxplusone.

I'd just done print(err) on old line 210, in my local checkout, but I assume your raise is better. :)

I'd just done print(err) on old line 210, in my local checkout, but I assume your raise is better. :)

Well, the benefit is that the exception will bubble up all the way and end Lit configuration, which is really what we want. And then its payload (the string) will be printed, which is also what we want.

ldionne updated this revision to Diff 389868.Thu, Nov 25, 12:34 PM

Rebase onto main now that the sanitizers are fixed.

ldionne accepted this revision as: Restricted Project.Thu, Nov 25, 12:34 PM

I will merge this once CI passes. I needed to land D114385 to fix the sanitizers build.

This revision is now accepted and ready to land.Thu, Nov 25, 12:34 PM