This is an archive of the discontinued LLVM Phabricator instance.

[clang] Fix assertion while parsing an invalid for loop
ClosedPublic

Authored by cor3ntin on Jun 2 2023, 10:16 AM.

Details

Summary

with multiple declarations followed by a colon.

Fixes #63010

Diff Detail

Event Timeline

cor3ntin created this revision.Jun 2 2023, 10:16 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 2 2023, 10:16 AM
cor3ntin requested review of this revision.Jun 2 2023, 10:16 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 2 2023, 10:16 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
cor3ntin updated this revision to Diff 527902.Jun 2 2023, 10:23 AM

revert ws changes

shafik added inline comments.Jun 2 2023, 2:58 PM
clang/lib/Parse/ParseStmt.cpp
2205

Can you explain why you removed this?

clang/test/Parser/cxx0x-for-range.cpp
67

Did you try dropping the ; at the end of this line to make sure it still does what we expect?

cor3ntin added inline comments.Jun 3 2023, 2:16 AM
clang/lib/Parse/ParseStmt.cpp
2205

The current diagnostics are pretty bad https://godbolt.org/z/z9odv3zjb - this fixes that

clang/test/Parser/cxx0x-for-range.cpp
67

yup, you think it's worth adding a test?

shafik accepted this revision.Jun 6 2023, 8:29 AM

LGTM

clang/test/Parser/cxx0x-for-range.cpp
67

Yes, I feel like so many bugs could have been fixed by having better coverage that would have caught them when they were committed in the first place.

This revision is now accepted and ready to land.Jun 6 2023, 8:29 AM
cor3ntin updated this revision to Diff 529186.Jun 6 2023, 11:55 PM

Add tests for missing semi colons

This revision was automatically updated to reflect the committed changes.