This is an archive of the discontinued LLVM Phabricator instance.

[ClangFormat] Only insert #include into the #include block in the beginning of the file.
ClosedPublic

Authored by ioeric on Nov 21 2016, 4:53 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

ioeric updated this revision to Diff 78703.Nov 21 2016, 4:53 AM
ioeric retitled this revision from to [ClangFormat] Do not insert #include into code after #include block in the beginning of the file..
ioeric updated this object.
ioeric added a reviewer: djasper.
ioeric added a subscriber: cfe-commits.

@djasper This is not very urgent. Feel free to leave it until you are back from vacation :)

ioeric retitled this revision from [ClangFormat] Do not insert #include into code after #include block in the beginning of the file. to [ClangFormat] Only insert #include into the #include block in the beginning of the file..Nov 21 2016, 5:00 AM
ioeric updated this revision to Diff 80039.Dec 2 2016, 2:08 AM
ioeric updated this object.Dec 2 2016, 2:09 AM
djasper added inline comments.Dec 2 2016, 2:12 AM
lib/Format/Format.cpp
1521 ↗(On Diff #80039)

I am somewhat hesitant to put more and more code here. Can we move some of this to a separate file? Is there a reasonable separation?

1601 ↗(On Diff #80039)

I might be useful to precisely describe (here or elsewhere) what is determined here, not from an implementation standpoint, but from what a user can expect.

ioeric updated this revision to Diff 80042.Dec 2 2016, 2:45 AM
ioeric marked an inline comment as done.
  • Updated comments.
lib/Format/Format.cpp
1521 ↗(On Diff #80039)

Yeah, it makes sense to separate these.

I'll do the refactoring in a followup patch to make the current change clear.

1601 ↗(On Diff #80039)

Added some more comments here and in the public interface.

djasper accepted this revision.Dec 2 2016, 2:48 AM
djasper edited edge metadata.

Looks good.

unittests/Format/CleanupTest.cpp
898 ↗(On Diff #80042)

Can you add a similar test or update this one that empty lines are also acceptable?

This revision is now accepted and ready to land.Dec 2 2016, 2:48 AM
ioeric updated this revision to Diff 80044.Dec 2 2016, 3:03 AM
ioeric marked an inline comment as done.
ioeric edited edge metadata.
  • Addressed comment.
This revision was automatically updated to reflect the committed changes.