mirror of
git://code.qt.io/qt/qt5.git
synced 2026-02-24 16:05:36 +08:00
clang-format: codify some of our conventions
1. We tend to use 2 spaces for indenting pre-processor directives, when we do it. Unfortunately clang-format also counts header-guards so not really recommended to use blindly on a header... 2. Add comments to namespaces, since the closing brace is simply a brace with no further decoration. 3. Attach escaped new-lines on the left (instead of current: right). Where 'right' will add the '\' characters on the far-right of our column limit, 'left' will put them as far left as it can while having them vertically aligned. Change-Id: Ib5a836c76f7761d743e0100c83e7db609b959249 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
This commit is contained in:
@@ -62,6 +62,8 @@ NamespaceIndentation: None
|
||||
|
||||
# Allow indentation for preprocessing directives (if/ifdef/endif). https://reviews.llvm.org/rL312125
|
||||
IndentPPDirectives: AfterHash
|
||||
# We only indent with 2 spaces for preprocessor directives
|
||||
PPIndentWidth: 2
|
||||
|
||||
# Horizontally align arguments after an open bracket.
|
||||
# The coding style does not specify the following, but this is what gives
|
||||
@@ -85,6 +87,21 @@ ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH, forever, Q_FOREVER, QBENCH
|
||||
# Break constructor initializers before the colon and after the commas.
|
||||
BreakConstructorInitializers: BeforeColon
|
||||
|
||||
# Add "// namespace <namespace>" comments on closing brace for a namespace
|
||||
# Ignored for namespaces that qualify as a short namespace,
|
||||
# see 'ShortNamespaceLines'
|
||||
FixNamespaceComments: true
|
||||
|
||||
# Definition of how short a short namespace is, default 1
|
||||
ShortNamespaceLines: 1
|
||||
|
||||
# When escaping newlines in a macro attach the '\' as far left as possible, e.g.
|
||||
##define a \
|
||||
# something; \
|
||||
# other; \
|
||||
# thelastlineislong;
|
||||
AlignEscapedNewlines: Left
|
||||
|
||||
# Avoids the addition of a space between an identifier and the
|
||||
# initializer list in list-initialization.
|
||||
SpaceBeforeCpp11BracedList: false
|
||||
|
||||
Reference in New Issue
Block a user