This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Add a better error message when failing to parse an attribute
ClosedPublic

Authored by rriddle on May 3 2022, 1:12 PM.

Details

Summary

The fallback attribute parse path is parsing a Type attribute, but this results
in a really unintuitive error message: expected non-function type, which
doesn't really hint at tall that we were trying to parse an attribute. This
commit fixes this by trying to optionally parse a type, and on failure
emitting an error that we were expecting an attribute.

Diff Detail

Event Timeline

rriddle created this revision.May 3 2022, 1:12 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald Transcript
rriddle requested review of this revision.May 3 2022, 1:12 PM
rriddle updated this revision to Diff 426813.May 3 2022, 1:15 PM
mehdi_amini accepted this revision.May 4 2022, 8:46 AM

Thanks! That "expected non-function type" message annoyed me so many times :)
(I suspect it will in other contexts than the one you're fixing)

This revision is now accepted and ready to land.May 4 2022, 8:46 AM
This revision was landed with ongoing or failed builds.May 5 2022, 3:07 PM
This revision was automatically updated to reflect the committed changes.