This is an archive of the discontinued LLVM Phabricator instance.

[flang] Finer control over error recovery with GetExpr()
ClosedPublic

Authored by klausler on Apr 15 2022, 1:27 PM.

Details

Summary

Prior to this patch, the semantics utility GetExpr() will crash
unconditionally if it encounters a typed expression in the parse
tree that has not been set by expression semantics. This is the
right behavior when called from lowering, by which time it is known
that the program had no fatal user errors, since it signifies a
fatal internal error. However, prior to lowering, in the statement
semantics checking code, a more nuanced test should be used before
crashing -- specifically, we should not crash in the face of a
missing typed expression when in error recovery mode.

Getting this right requires GetExpr() and its helper class to have
access to the semantics context, so that it can check AnyFatalErrors()
before crashing. So this patch touches nearly all of its call sites.

Diff Detail

Event Timeline

klausler created this revision.Apr 15 2022, 1:27 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 15 2022, 1:27 PM
Herald added a subscriber: jdoerfert. · View Herald Transcript
klausler requested review of this revision.Apr 15 2022, 1:27 PM
vdonaldson accepted this revision.Apr 15 2022, 1:39 PM
This revision is now accepted and ready to land.Apr 15 2022, 1:39 PM
This revision was automatically updated to reflect the committed changes.