Set IncludeBlocks: Regroup clang-format option

XMLWordPrintableJSON

    • Server Programmability
    • Fully Compatible
    • None
    • 3
    • TBD
    • None
    • None
    • None
    • None
    • None
    • None

      The main purpose of this change is to have clang-format handle the grouping of headers and the ordering of those groups. Our style guide currently requires that the headers follow the order:

      1. main header
      2. third-party headers
      3. first-party headers

      However, many files don't follow that rule. Also clangd when it inserts headers will violate it. By turning on IncludeBlocks: Reorder clang-format will automatically handle this bit of formatting for us, and clangd will start putting the headers in the right places. Note that it will only reorder headers across blank lines: non-blank, non-include lines (including comments and other directives like #if or #undef) will act as barriers to reordering.

      As part of this change we are switching to a new order:

      1. main header
      2. first-party headers
      3. c++ stdlib headers (no / and no . in path)
      4. unnamespaced headers (no / in path)
      5. remaining third-party headers

      This is intended to make it both more likely to detect first-party headers that are missing includes, and makes it a bit easier to visually scan through the third-party headers.

            Assignee:
            Mathias Stearn
            Reporter:
            Mathias Stearn
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: