This is an archive of the discontinued LLVM Phabricator instance.

[MC] Diagnose MCContext errors using LLVMContext handler
AbandonedPublic

Authored by ychen on Feb 19 2021, 10:28 AM.

Details

Summary

This happens before we reset the MCContext so that errors are propagated
to users. Without this, some errors are silently ignored even with a
correct error message.

Diff Detail

Event Timeline

ychen created this revision.Feb 19 2021, 10:28 AM
ychen requested review of this revision.Feb 19 2021, 10:28 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 19 2021, 10:28 AM
This revision is now accepted and ready to land.Feb 19 2021, 10:44 AM
rnk added inline comments.Feb 22 2021, 11:18 AM
llvm/lib/CodeGen/MachineModuleInfo.cpp
172–173

This doesn't seem like a great user experience. Won't we get two errors, something like the following?

error: lds: unsupported initializer for address space
error: MC error

It seems worth adding an LLVMContext API to mark errors as having been reported another way if we don't have plans to unify MCContext / LLVMContext error reporting in the short term.

This happens before we reset the MCContext so that errors are propagated to users.

reset -> because?

Perhaps also document the error code change.

Thanks for the comment. I didn't find a satisfying workaround for this issue so I went ahead going the way @rnk suggested and wrote the better fix. D97449

ychen abandoned this revision.Mar 2 2021, 4:07 PM

Committed D97449 instead.