This is an archive of the discontinued LLVM Phabricator instance.

[AST][RecoveryExpr] Part4: Support dependent cast-expr in C for error-recovery.
ClosedPublic

Authored by hokein on Jul 23 2020, 12:12 AM.

Details

Summary

Suppress spurious "typecheck_cond_expect_scalar_operand" diagnostic.

See whole context: https://reviews.llvm.org/D85025

Diff Detail

Unit TestsFailed

Event Timeline

hokein created this revision.Jul 23 2020, 12:12 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 23 2020, 12:12 AM
hokein marked an inline comment as done.Jul 23 2020, 12:17 AM
hokein added inline comments.
clang/lib/Sema/SemaCast.cpp
2712

This is similar to the way how C++ codepath handles dependent code, https://github.com/llvm/llvm-project/blob/master/clang/lib/Sema/SemaCast.cpp#L2527-L2532.

Sorry for losing track of this. Where is CDependence defined? Is this stacked on another patch?

hokein retitled this revision from [AST][RecoveryExpr] Suppress spurious "err_typecheck_expect_scalar_operand" diagnostic to [AST][RecoveryExpr] Part4: Suppress spurious "err_typecheck_expect_scalar_operand" diagnostic.Aug 17 2020, 4:03 AM

Sorry for losing track of this. Where is CDependence defined? Is this stacked on another patch?

yes. Sorry for not being clear here, this is stacked on another patch. I have renamed these patches (Part 1, 2, 3...). The review should go Part 1 first.

I'm not sure I love having the assertion for contains-errors every place that handles dependent code in C.
We should certainly somehow document the reason dependence is possible, just as the possibility of overloads is documented.
But the assertion seems pretty heavyweight :-\

clang/lib/Sema/SemaCast.cpp
2712

also copy the comment?

hokein updated this revision to Diff 296611.Oct 7 2020, 12:39 AM
hokein marked an inline comment as done.

rebase

I'm not sure I love having the assertion for contains-errors every place that handles dependent code in C.

My feeling is that the assertion would help for understanding the code (comparing with documenting it somewhere), and we don't have too many places.

sammccall accepted this revision.Oct 7 2020, 9:56 AM
This revision is now accepted and ready to land.Oct 7 2020, 9:56 AM
hokein retitled this revision from [AST][RecoveryExpr] Part4: Suppress spurious "err_typecheck_expect_scalar_operand" diagnostic to [AST][RecoveryExpr] Part4: Support dependent cast-expr in C for error-recovery..Oct 8 2020, 12:44 AM
hokein edited the summary of this revision. (Show Details)
This revision was landed with ongoing or failed builds.Oct 8 2020, 1:03 AM
This revision was automatically updated to reflect the committed changes.