This is an archive of the discontinued LLVM Phabricator instance.

[clang-format] Separate line comment sections after a right brace from comment sections in the scope.
ClosedPublic

Authored by krasimir on Jan 30 2017, 10:58 AM.

Details

Summary

The following two comment lines form a single comment section:

if (1) { // line 1
   // line 2
}

This is because the break of a comment section was based on the original column
of the first token of the previous line (in this case, the 'if').
This patch splits these two comment lines into different sections by taking into
account the original column of the right brace preceding the first line comment
where applicable.

Diff Detail

Repository
rL LLVM

Event Timeline

krasimir created this revision.Jan 30 2017, 10:58 AM
krasimir updated this revision to Diff 86313.Jan 30 2017, 11:01 AM
  • Fix typos in the explanation.
krasimir edited the summary of this revision. (Show Details)
krasimir added a subscriber: cfe-commits.
djasper accepted this revision.Jan 30 2017, 11:16 AM
djasper added inline comments.
lib/Format/UnwrappedLineParser.cpp
2095 ↗(On Diff #86313)

Just remove this. It leaks PreviousToken, but that's ok.

This revision is now accepted and ready to land.Jan 30 2017, 11:16 AM
krasimir updated this revision to Diff 86316.Jan 30 2017, 11:24 AM
  • Remove scope
This revision was automatically updated to reflect the committed changes.
krasimir marked an inline comment as done.Jan 30 2017, 11:30 AM