This is an archive of the discontinued LLVM Phabricator instance.

[AST] Improve overflow diagnostics for fixed-point constant evaluation.
ClosedPublic

Authored by ebevhan on Jan 22 2020, 6:25 AM.

Details

Summary

Diagnostics for overflow were not being produced for fixed-point
evaluation. This patch refactors a bit of the evaluator and adds
a proper diagnostic for these cases.

Event Timeline

ebevhan created this revision.Jan 22 2020, 6:25 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 22 2020, 6:25 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
leonardchan accepted this revision.Jan 22 2020, 5:31 PM

Could you also add a few test lines showing this warning doesn't appear for operations where the result is a saturated type?

This revision is now accepted and ready to land.Jan 22 2020, 5:31 PM
ebevhan updated this revision to Diff 239799.Jan 23 2020, 12:41 AM

Added tests for saturating types. Changed the warning group name for consistency.

ebevhan updated this revision to Diff 255978.Apr 8 2020, 5:10 AM

Rebased.

rjmccall accepted this revision.Apr 10 2020, 6:08 PM

LGTM. I'm somewhat surprised that this is the implementation design for integer overflow diagnostics, but since it is, I see no reason not to adopt it for fixed-point as well.

This revision was automatically updated to reflect the committed changes.