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

Chandler Carruth chandlerc at gmail.com
Thu Nov 29 19:05:30 PST 2012


Hello,

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.

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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147.1.patch
Type: text/x-patch
Size: 716 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121129/d2044deb/attachment.bin>


More information about the llvm-commits mailing list