[llvm-commits] [PATCH] Simplify the #include ordering rules of the coding standards

Duncan Sands baldrick at free.fr
Thu Nov 29 21:04:08 PST 2012


Hi Chandler,

> I've done a fair amount of moving headers around to fix layering issues, and I am continually frustrated by the fact that most of the #include sections of files in LLVM (and Clang to a lesser degree) do not actually follow the coding standards strictly. But honestly, that's because the coding standards are really hard to follow with a somewhat unexplained sequencing in the middle.
>
> This will become especially confusing when I begin moving headers from the top level tree in LLVM into an 'IR' subdirectory.
>
> I propose to simplify the rules: just lump all the 'llvm' headers that aren't treated specially into one group, and run your editor's 'sort' command over them.

it seems reasonable to me.  Do you have a magic script for reordering the
includes in the existing code base?

Ciao, Duncan.

>
> Thoughts?
> -Chandler
>
> http://llvm-reviews.chandlerc.com/D147
>
> Files:
>    docs/CodingStandards.rst
>
> Index: docs/CodingStandards.rst
> ===================================================================
> --- docs/CodingStandards.rst
> +++ docs/CodingStandards.rst
> @@ -284,17 +284,10 @@
>
>   #. Main Module Header
>   #. Local/Private Headers
> -#. ``llvm/*``
> -#. ``llvm/Analysis/*``
> -#. ``llvm/Assembly/*``
> -#. ``llvm/Bitcode/*``
> -#. ``llvm/CodeGen/*``
> -#. ...
> -#. ``llvm/Support/*``
> -#. ``llvm/Config/*``
> +#. ``llvm/...``
>   #. System ``#include``\s
>
> -and each category should be sorted by name.
> +and each category should be sorted lexicographically by the full path.
>
>   The `Main Module Header`_ file applies to ``.cpp`` files which implement an
>   interface defined by a ``.h`` file.  This ``#include`` should always be included
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>




More information about the llvm-commits mailing list