This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by ldionne on Nov 16 2021, 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.Nov 16 2021, 9:40 AM
ldionne requested review of this revision.Nov 16 2021, 9:40 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 16 2021, 9:40 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
Mordante accepted this revision as: Mordante.Nov 16 2021, 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.Nov 19 2021, 2:33 PM

Fix the dsl tests.

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.Nov 25 2021, 12:34 PM

Rebase onto main now that the sanitizers are fixed.

ldionne accepted this revision as: Restricted Project.Nov 25 2021, 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.Nov 25 2021, 12:34 PM