[go: nahoru, domu]

blob: ce7d0ad33ef0201536a5222f7462fad82bd0abcb [file] [log] [blame]
jyasskin@chromium.org452ed0ea2013-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
Takuto Ikutad0bcf2122024-04-17 15:37:0431 - Regex: '^<(initguid|mmdeviceapi|windows|winsock2|ws2tcpip|shobjidl|atlbase|ole2|unknwn|tchar|ocidl)\.h>'
Takuto Ikuta4ecc218a2024-03-27 13:08:3432 Priority: 2
33 # LINT.ThenChange(/tools/add_header.py:winheader)
34 # UIAutomation*.h need to be after base/win/atl.h.
35 # 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.
42 - Regex: '^<.*'
43 Priority: 4
44 # Other libraries.
45 - Regex: '.*'
46 Priority: 5
47# ref: https://clang.llvm.org/docs/ClangFormatStyleOptions.html#includeismainregex
48IncludeIsMainRegex: "\
Takuto Ikutac8d6b16f2024-04-15 16:59:1949(_(32|64|android|apple|chromeos|freebsd|fuchsia|fuzzer|ios|linux|mac|nacl|openbsd|posix|stubs?|win))?\
Takuto Ikuta4ecc218a2024-03-27 13:08:3450(_(unit|browser|perf)?tests?)?$"
51
Daniel Cheng9ce8be42015-07-16 21:44:5852# Make sure code like:
53# IPC_BEGIN_MESSAGE_MAP()
54# IPC_MESSAGE_HANDLER(WidgetHostViewHost_Update, OnUpdate)
55# IPC_END_MESSAGE_MAP()
56# gets correctly indented.
57MacroBlockBegin: "^\
58BEGIN_MSG_MAP|\
59BEGIN_MSG_MAP_EX|\
60BEGIN_SAFE_MSG_MAP_EX|\
61CR_BEGIN_MSG_MAP_EX|\
62IPC_BEGIN_MESSAGE_MAP|\
63IPC_BEGIN_MESSAGE_MAP_WITH_PARAM|\
dcheng0941e7d82015-07-17 03:51:4564IPC_PROTOBUF_MESSAGE_TRAITS_BEGIN|\
Daniel Cheng9ce8be42015-07-16 21:44:5865IPC_STRUCT_BEGIN|\
66IPC_STRUCT_BEGIN_WITH_PARENT|\
dcheng0941e7d82015-07-17 03:51:4567IPC_STRUCT_TRAITS_BEGIN|\
68POLPARAMS_BEGIN|\
69PPAPI_BEGIN_MESSAGE_MAP$"
Daniel Cheng9ce8be42015-07-16 21:44:5870MacroBlockEnd: "^\
71CR_END_MSG_MAP|\
72END_MSG_MAP|\
73IPC_END_MESSAGE_MAP|\
dcheng0941e7d82015-07-17 03:51:4574IPC_PROTOBUF_MESSAGE_TRAITS_END|\
Daniel Cheng9ce8be42015-07-16 21:44:5875IPC_STRUCT_END|\
dcheng0941e7d82015-07-17 03:51:4576IPC_STRUCT_TRAITS_END|\
77POLPARAMS_END|\
78PPAPI_END_MESSAGE_MAP$"