Commit graph

6 commits

Author SHA1 Message Date
Christopher Ferris
fdaf82f96b Link .clang-format file to system/core one.
Use the .clang-format-2 found in system/core instead of this which is
not actually being used.

Also, enable clang-format running by default.

All upstream directories are marked as ignoring formatting so that
their source files are not modified.

Test: NA
Change-Id: Icee6030f373fa5f072df162f97e6f34320e3d89a
2020-01-29 15:14:20 -08:00
Tom Cherry
ef18d440d9 clang-format: Add IncludeBlocks: Preserve
The same change and reasoning as
c077eefc1e5007a5c656183737e82d5c0a7df855 in build/soong, copied below:

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 <android-base/properties.h>
+#include <android-base/strings.h>
 #include <ctype.h>
 #include <stdlib.h>
 #include <sys/system_properties.h>

 #include <iostream>

-#include <android-base/properties.h>
-#include <android-base/strings.h>

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 <sys/wait.h> and
<other_lib/header.h>.

[1]:
62e3198c4f (diff-b689ebff2e51e675b346a88289e74542)

Test: clang-format doesn't do the above.
Change-Id: I2e3f6ee75fd725b620174082afcce4ee7f4efa66
2019-11-05 12:29:56 -08:00
Josh Gao
5a9d5691a4 Fix .clang-format ContinuationIndentWidth.
Change-Id: If41900122accb2c1ebf012bfa07de9b0fa9690fc
2016-06-01 18:20:15 -07:00
Josh Gao
615f3aa8b4 Add 100 column limit to .clang-format.
Change-Id: I3c3fa5e61cfb2af7f2888dcee56229692ec1479c
2015-11-11 14:21:09 -08:00
Josh Gao
8258cd7c1b Improve .clang-format.
Change-Id: Idfd7879cc3bf1a1cdbe33262c2506fac2f07b428
2015-08-24 13:00:13 -07:00
Dan Albert
6e68c07550 Add a .clang-format file.
Change-Id: I6c4c492d9b571dd654b4993d1de1827813963ce1
2015-08-24 11:27:58 -07:00