This is an archive of the discontinued LLVM Phabricator instance.

[Clang] Modify Parser::ParseLambdaExpressionAfterIntroducer to check whether the lambda-declarator is valid
ClosedPublic

Authored by shafik on Aug 24 2023, 9:02 PM.

Details

Summary

We had a couple of crashes due to invalid lambda trailing return types that were diagnosed but not treated as errors during parsing. So now in Parser::ParseLambdaExpressionAfterIntroducer(...) after ActOnStartOfLambdaDefinition(...) we also check if the lambda-declarator is invalid and if so we end up in ActOnLambdaError(...).

Fixes: https://github.com/llvm/llvm-project/issues/64962
https://github.com/llvm/llvm-project/issues/28679

Diff Detail

Event Timeline

shafik created this revision.Aug 24 2023, 9:02 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 24 2023, 9:02 PM
shafik requested review of this revision.Aug 24 2023, 9:02 PM

LGTM modulo:

  • No release notes
  • I think you need to write in the commit
Fixes  https://github.com/llvm/llvm-project/issues/64962
Fixes https://github.com/llvm/llvm-project/issues/28679

for github not to be confused

  • You need to clang-format
clang/test/Parser/cxx0x-lambda-expressions.cpp
2 ↗(On Diff #553342)

We might want to put that test in clang/test/Parser/cxx2a-template-lambdas.cpp instead

shafik updated this revision to Diff 553692.Aug 25 2023, 8:14 PM
  • Move test to C++20 file
  • Apply clang-format
shafik edited the summary of this revision. (Show Details)Aug 25 2023, 8:14 PM

Still missing a release note.

shafik updated this revision to Diff 554345.Aug 29 2023, 8:03 AM
  • Add release notes
cor3ntin accepted this revision.Aug 29 2023, 10:20 AM

Thanks!

This revision is now accepted and ready to land.Aug 29 2023, 10:20 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 29 2023, 11:31 AM