This is an archive of the discontinued LLVM Phabricator instance.

[clang-format] handle trailing comments in function definition detection
ClosedPublic

Authored by krasimir on Aug 11 2021, 8:06 AM.

Details

Diff Detail

Event Timeline

krasimir requested review of this revision.Aug 11 2021, 8:06 AM
krasimir created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptAug 11 2021, 8:06 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
This revision is now accepted and ready to land.Aug 11 2021, 10:01 AM

I thought of it last time but didn't try hard to come up with a test case that would make a difference. :( Thanks for finding the hole!

owenpan added inline comments.Aug 11 2021, 12:09 PM
clang/lib/Format/TokenAnnotator.cpp
2486–2487
if (Next->Next && Next->Next->is(tok::identifier) &&
    !Line.endsWith(tok::semi))
  return true;
krasimir updated this revision to Diff 365918.Aug 11 2021, 11:54 PM
  • apply reviewer suggestion
krasimir marked an inline comment as done.Aug 11 2021, 11:54 PM
This revision was landed with ongoing or failed builds.Aug 11 2021, 11:56 PM
This revision was automatically updated to reflect the committed changes.
owenpan added a project: Restricted Project.Aug 12 2021, 1:46 PM