Invalidate BlockDecl with implicit return type, in case any of the return value exprs is invalid.
Propagating the error info up by replacing BlockExpr with a RecoveryExpr.
(The idea of this fix is given by @hokein(Haojian Wu))
Differential D155396
[Sema][ObjC] Invalidate BlockDecl with invalid return expr & its parent BlockExpr danix800 on Jul 16 2023, 2:24 AM. Authored by
Details Invalidate BlockDecl with implicit return type, in case any of the return value exprs is invalid. (The idea of this fix is given by @hokein(Haojian Wu))
Diff Detail
Unit Tests Event Timeline
Comment Actions
Comment Actions Invalidate BlockDecl with implicit return type, in case any of the return value exprs is invalid. Comment Actions This looks pretty good to me. Can you also add a release note for the fix to clang/docs/ReleaseNotes.rst?
Comment Actions thanks!
Comment Actions
Comment Actions Dropping the entire block from the AST on error would be unfortunate for some kinds of tooling, but as long as we maintain it with a RecoveryExpr, that seems like a fine approach to me. As a general rule, I think we should be tracking basically everything on the BlockDecl and let BlockExpr just have a reference to that on top of the baseline Expr storage.
|
Hmmm -- is the block *expression* what contains the errors in this case or is it the block declaration? I would have expected this to be an issue for the block declaration created for the block expression. CC @rjmccall