This is an archive of the discontinued LLVM Phabricator instance.

[AST][RecoveryExpr] Populate the dependence bits from CompoundStmt result expr to StmtExpr.
ClosedPublic

Authored by hokein on Jun 4 2020, 5:49 AM.

Details

Summary

We lost errorBit for StmtExpr if a recoveryExpr is the result
expr of a CompoundStmt, which will lead to crashes.

// `-StmtExpr
//   `-CompoundStmt
//     `-RecoveryExp
({ invalid(); });

Diff Detail

Event Timeline

hokein created this revision.Jun 4 2020, 5:49 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 4 2020, 5:49 AM
sammccall accepted this revision.Jun 8 2020, 1:22 AM
sammccall added inline comments.
clang/lib/AST/ComputeDependence.cpp
130–131

I think I know the answer now - you can't expand a param pack over stmtexpr boundaries. Could repace this comment...

130–131

I wonder if this is still needed - how can we get a type for the stmtexpr unless we have a result expr providing the type?

137

Nit: i'd probably leave this as the last clause as it's the weird edge case.

143

Maybe just "propagate dependence of the result"? The compound statement seems like a red herring.

148

this should avoid propagating the pack bit as above (or factor it out and mask it off at the end to avoid writing it twice)

This revision is now accepted and ready to land.Jun 8 2020, 1:22 AM
hokein updated this revision to Diff 269197.Jun 8 2020, 6:24 AM
hokein marked 5 inline comments as done.

address comments.

clang/lib/AST/ComputeDependence.cpp
130–131

it is possible that the stmtexpr has a type and doesn't have a result expr, e.g ({ if (1) {}; }), the default type is void.

This revision was automatically updated to reflect the committed changes.