[llvm-dev] Any objections to re-sorting #include lines with clang-format/clang-tidy?
David Blaikie via llvm-dev
llvm-dev at lists.llvm.org
Fri Mar 11 17:08:16 PST 2016
On Fri, Mar 11, 2016 at 5:02 PM, Chris Lattner via llvm-dev <
llvm-dev at lists.llvm.org> wrote:
>
> > On Mar 11, 2016, at 1:14 AM, Chandler Carruth via llvm-dev <
> llvm-dev at lists.llvm.org> wrote:
> >
> > The crazy clang-format folks have taught it to sort includes, and
> clang-tidy has a nice way to run it across all of LLVM and Clang.
> >
> > Before I just submit the fixes (and any bug reports to the clang-format
> folks if it sorts things weirdly) I wanted to double check that folks would
> be ok with this. My understanding is that the sorting should match the LLVM
> conventions, but if not, I'll make sure to get that fixed first.
>
> Does it do it the “right” way? I think it is important for a .cpp file to
> include its corresponding header first (to ensure it stays self contained).
>
Believe it does, yes. At least for the basic/obvious cases:
foo.cpp containing includes of b.h, foo.h, a.h -> foo.h, a.h, b.h
(also, with modules builds, it may no longer be necessary to include the
primary header first to ensure it remains self contained (but yeah, until
we're all using modules builds, it'll be useful so that non-modular builds
don't silently break this invariant))
>
> -Chris
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160311/325dad05/attachment.html>
More information about the llvm-dev
mailing list