From c077eefc1e5007a5c656183737e82d5c0a7df855 Mon Sep 17 00:00:00 2001 From: Tom Cherry Date: Wed, 5 Jun 2019 15:30:14 -0700 Subject: [PATCH] system-clang-format: Add IncludeBlocks: Preserve As of [1], the Google format, which we default to, uses IncludeBlocks: Regroup, which sorts all includes with <> and without .h into the top group reserved for libc headers, e.g.: +#include +#include #include #include #include #include -#include -#include This is accurate to the Google C++ style guide, which states that other library headers should be included with "", however we have a strong tendency to use <> for these headers for Android, so we must revert this change. Note, clang-format allows regexes for creating the blocks as well, however, short of including all possible libc headers, I don't think there's a way to differentiate between and . [1]: https://github.com/llvm-mirror/clang/commit/62e3198c4f5490a1c60ba51d81fe2e1f0dc99135#diff-b689ebff2e51e675b346a88289e74542 Test: clang-format doesn't do the above. Change-Id: Ifef605ffd6b4c8a36512377644e64ddd26b68a21 --- scripts/system-clang-format | 1 + scripts/system-clang-format-2 | 1 + 2 files changed, 2 insertions(+) diff --git a/scripts/system-clang-format b/scripts/system-clang-format index 55773a29f..14abd934b 100644 --- a/scripts/system-clang-format +++ b/scripts/system-clang-format @@ -4,6 +4,7 @@ AllowShortFunctionsOnASingleLine: Inline ColumnLimit: 100 CommentPragmas: NOLINT:.* DerivePointerAlignment: false +IncludeBlocks: Preserve IndentWidth: 4 ContinuationIndentWidth: 8 PointerAlignment: Left diff --git a/scripts/system-clang-format-2 b/scripts/system-clang-format-2 index ede5d7e18..e28b379c4 100644 --- a/scripts/system-clang-format-2 +++ b/scripts/system-clang-format-2 @@ -3,6 +3,7 @@ AllowShortFunctionsOnASingleLine: Inline ColumnLimit: 100 CommentPragmas: NOLINT:.* DerivePointerAlignment: false +IncludeBlocks: Preserve IndentWidth: 2 PointerAlignment: Left TabWidth: 2