blob: 688253e53adbea1a2b25e20441975ee25f39974c [file] [log] [blame]
[email protected]452ed0ea2013-11-01 01:53:401# Defines the Chromium style for automatic reformatting.
2# http://clang.llvm.org/docs/ClangFormatStyleOptions.html
3BasedOnStyle: Chromium
thakis1c79f8642014-10-31 23:00:184# This defaults to 'Auto'. Explicitly set it for a while, so that
5# 'vector<vector<int> >' in existing files gets formatted to
6# 'vector<vector<int>>'. ('Auto' means that clang-format will only use
7# 'int>>' if the file already contains at least one such instance.)
scottmg57e3f0a2014-09-25 06:32:458Standard: Cpp11
thakis6b08b5d2017-02-02 23:31:449
Peter Boström9f9b576d2022-12-13 19:02:3310# TODO(crbug.com/1392808): Remove when InsertBraces has been upstreamed into
11# the Chromium style (is implied by BasedOnStyle: Chromium).
12InsertBraces: true
Zequan Wua84a23ae2023-03-22 18:12:2913InsertNewlineAtEOF: true
Peter Boström9f9b576d2022-12-13 19:02:3314
Takuto Ikuta4ecc218a2024-03-27 13:08:3415# Sort #includes by following
16# https://google.github.io/styleguide/cppguide.html#Names_and_Order_of_Includes
17#
18# ref: https://clang.llvm.org/docs/ClangFormatStyleOptions.html#includeblocks
19IncludeBlocks: Regroup
20# ref: https://clang.llvm.org/docs/ClangFormatStyleOptions.html#includecategories
21IncludeCategories:
22 # The win32 api has all sorts of implicit include order dependencies :-/
23 # Give a few headers special priorities that make sure they appear before
24 # all other headers.
25 # Sync this with SerializeIncludes in tools/add_header.py.
26 # TODO(crbug.com/329138753): remove include sorting from tools/add_header.py
27 # after confirming clang-format sort works well.
28 # LINT.IfChange(winheader)
29 - Regex: '^<objbase\.h>' # This has to be before initguid.h.
30 Priority: 1
Peter Kastingb9d8d6a2024-10-08 18:33:1031 - Regex: '^<(atlbase|initguid|mmdeviceapi|ocidl|ole2|shobjidl|tchar|unknwn|windows|winsock2|winternl|ws2tcpip)\.h>'
Takuto Ikuta4ecc218a2024-03-27 13:08:3432 Priority: 2
33 # LINT.ThenChange(/tools/add_header.py:winheader)
Peter Kastingb9d8d6a2024-10-08 18:33:1034 # UIAutomation*.h needs to be after base/win/atl.h.
Takuto Ikuta4ecc218a2024-03-27 13:08:3435 # Note the low priority number.
36 - Regex: '^<UIAutomation.*\.h>'
37 Priority: 6
38 # Other C system headers.
39 - Regex: '^<.*\.h>'
40 Priority: 3
41 # C++ standard library headers.
Peter Kastingb9d8d6a2024-10-08 18:33:1042 - Regex: '^<.*>'
Takuto Ikuta4ecc218a2024-03-27 13:08:3443 Priority: 4
Peter Kastingb9d8d6a2024-10-08 18:33:1044 # windows_h_disallowed.h should appear last. Note the low priority number.
45 - Regex: '"(.*/)?windows_h_disallowed\.h"'
46 Priority: 7
Takuto Ikuta4ecc218a2024-03-27 13:08:3447 # Other libraries.
48 - Regex: '.*'
49 Priority: 5
50# ref: https://clang.llvm.org/docs/ClangFormatStyleOptions.html#includeismainregex
51IncludeIsMainRegex: "\
Takuto Ikutac8d6b16f2024-04-15 16:59:1952(_(32|64|android|apple|chromeos|freebsd|fuchsia|fuzzer|ios|linux|mac|nacl|openbsd|posix|stubs?|win))?\
Takuto Ikuta4ecc218a2024-03-27 13:08:3453(_(unit|browser|perf)?tests?)?$"
54
Daniel Cheng9ce8be42015-07-16 21:44:5855# Make sure code like:
56# IPC_BEGIN_MESSAGE_MAP()
57# IPC_MESSAGE_HANDLER(WidgetHostViewHost_Update, OnUpdate)
58# IPC_END_MESSAGE_MAP()
59# gets correctly indented.
60MacroBlockBegin: "^\
61BEGIN_MSG_MAP|\
62BEGIN_MSG_MAP_EX|\
63BEGIN_SAFE_MSG_MAP_EX|\
64CR_BEGIN_MSG_MAP_EX|\
65IPC_BEGIN_MESSAGE_MAP|\
66IPC_BEGIN_MESSAGE_MAP_WITH_PARAM|\
dcheng0941e7d82015-07-17 03:51:4567IPC_PROTOBUF_MESSAGE_TRAITS_BEGIN|\
Daniel Cheng9ce8be42015-07-16 21:44:5868IPC_STRUCT_BEGIN|\
69IPC_STRUCT_BEGIN_WITH_PARENT|\
dcheng0941e7d82015-07-17 03:51:4570IPC_STRUCT_TRAITS_BEGIN|\
71POLPARAMS_BEGIN|\
72PPAPI_BEGIN_MESSAGE_MAP$"
Daniel Cheng9ce8be42015-07-16 21:44:5873MacroBlockEnd: "^\
74CR_END_MSG_MAP|\
75END_MSG_MAP|\
76IPC_END_MESSAGE_MAP|\
dcheng0941e7d82015-07-17 03:51:4577IPC_PROTOBUF_MESSAGE_TRAITS_END|\
Daniel Cheng9ce8be42015-07-16 21:44:5878IPC_STRUCT_END|\
dcheng0941e7d82015-07-17 03:51:4579IPC_STRUCT_TRAITS_END|\
80POLPARAMS_END|\
81PPAPI_END_MESSAGE_MAP$"