[PATCH] D26909: [ClangFormat] Only insert #include into the #include block in the beginning of the file.

Eric Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 2 02:45:40 PST 2016


ioeric added inline comments.


================
Comment at: lib/Format/Format.cpp:1521
+// tokens and returns an offset after the sequence.
+unsigned getOffsetAfterTokenSequence(
+    StringRef FileName, StringRef Code, const FormatStyle &Style,
----------------
djasper wrote:
> 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?
Yeah, it makes sense to separate these.

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


================
Comment at: lib/Format/Format.cpp:1601
+
+// Returns the offset of the last #include directive after which a new
+// #include can be inserted. If no such #include in the code, this returns the
----------------
djasper wrote:
> 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.
Added some more comments here and in the public interface.


https://reviews.llvm.org/D26909





More information about the cfe-commits mailing list