clang-format-12
This commit is contained in:
parent
31253f400d
commit
29cbf8b83f
|
@ -2,16 +2,18 @@
|
||||||
Language: Cpp
|
Language: Cpp
|
||||||
AccessModifierOffset: -2
|
AccessModifierOffset: -2
|
||||||
AlignAfterOpenBracket: Align
|
AlignAfterOpenBracket: Align
|
||||||
AlignConsecutiveMacros: false
|
AlignConsecutiveMacros: None
|
||||||
AlignConsecutiveAssignments: false
|
AlignConsecutiveAssignments: None
|
||||||
AlignConsecutiveDeclarations: false
|
AlignConsecutiveBitFields: None
|
||||||
|
AlignConsecutiveDeclarations: None
|
||||||
AlignEscapedNewlines: Right
|
AlignEscapedNewlines: Right
|
||||||
AlignOperands: true
|
AlignOperands: Align
|
||||||
AlignTrailingComments: true
|
AlignTrailingComments: true
|
||||||
AllowAllArgumentsOnNextLine: true
|
AllowAllArgumentsOnNextLine: true
|
||||||
AllowAllConstructorInitializersOnNextLine: true
|
AllowAllConstructorInitializersOnNextLine: true
|
||||||
AllowAllParametersOfDeclarationOnNextLine: true
|
AllowAllParametersOfDeclarationOnNextLine: true
|
||||||
AllowShortBlocksOnASingleLine: false
|
AllowShortEnumsOnASingleLine: true
|
||||||
|
AllowShortBlocksOnASingleLine: Never
|
||||||
AllowShortCaseLabelsOnASingleLine: false
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
AllowShortFunctionsOnASingleLine: All
|
AllowShortFunctionsOnASingleLine: All
|
||||||
AllowShortLambdasOnASingleLine: All
|
AllowShortLambdasOnASingleLine: All
|
||||||
|
@ -21,12 +23,14 @@ AlwaysBreakAfterDefinitionReturnType: None
|
||||||
AlwaysBreakAfterReturnType: None
|
AlwaysBreakAfterReturnType: None
|
||||||
AlwaysBreakBeforeMultilineStrings: false
|
AlwaysBreakBeforeMultilineStrings: false
|
||||||
AlwaysBreakTemplateDeclarations: MultiLine
|
AlwaysBreakTemplateDeclarations: MultiLine
|
||||||
|
AttributeMacros:
|
||||||
|
- __capability
|
||||||
BinPackArguments: true
|
BinPackArguments: true
|
||||||
BinPackParameters: true
|
BinPackParameters: true
|
||||||
BraceWrapping:
|
BraceWrapping:
|
||||||
AfterCaseLabel: false
|
AfterCaseLabel: false
|
||||||
AfterClass: false
|
AfterClass: false
|
||||||
AfterControlStatement: false
|
AfterControlStatement: Never
|
||||||
AfterEnum: false
|
AfterEnum: false
|
||||||
AfterFunction: false
|
AfterFunction: false
|
||||||
AfterNamespace: false
|
AfterNamespace: false
|
||||||
|
@ -36,11 +40,14 @@ BraceWrapping:
|
||||||
AfterExternBlock: false
|
AfterExternBlock: false
|
||||||
BeforeCatch: false
|
BeforeCatch: false
|
||||||
BeforeElse: false
|
BeforeElse: false
|
||||||
|
BeforeLambdaBody: false
|
||||||
|
BeforeWhile: false
|
||||||
IndentBraces: false
|
IndentBraces: false
|
||||||
SplitEmptyFunction: true
|
SplitEmptyFunction: true
|
||||||
SplitEmptyRecord: true
|
SplitEmptyRecord: true
|
||||||
SplitEmptyNamespace: true
|
SplitEmptyNamespace: true
|
||||||
BreakBeforeBinaryOperators: None
|
BreakBeforeBinaryOperators: None
|
||||||
|
BreakBeforeConceptDeclarations: true
|
||||||
BreakBeforeBraces: Attach
|
BreakBeforeBraces: Attach
|
||||||
BreakBeforeInheritanceComma: false
|
BreakBeforeInheritanceComma: false
|
||||||
BreakInheritanceList: BeforeColon
|
BreakInheritanceList: BeforeColon
|
||||||
|
@ -56,27 +63,43 @@ ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
||||||
ConstructorInitializerIndentWidth: 4
|
ConstructorInitializerIndentWidth: 4
|
||||||
ContinuationIndentWidth: 4
|
ContinuationIndentWidth: 4
|
||||||
Cpp11BracedListStyle: true
|
Cpp11BracedListStyle: true
|
||||||
|
DeriveLineEnding: true
|
||||||
DerivePointerAlignment: false
|
DerivePointerAlignment: false
|
||||||
DisableFormat: false
|
DisableFormat: false
|
||||||
|
EmptyLineBeforeAccessModifier: LogicalBlock
|
||||||
ExperimentalAutoDetectBinPacking: false
|
ExperimentalAutoDetectBinPacking: false
|
||||||
FixNamespaceComments: true
|
FixNamespaceComments: true
|
||||||
ForEachMacros:
|
ForEachMacros:
|
||||||
- foreach
|
- foreach
|
||||||
- Q_FOREACH
|
- Q_FOREACH
|
||||||
- BOOST_FOREACH
|
- BOOST_FOREACH
|
||||||
|
StatementAttributeLikeMacros:
|
||||||
|
- Q_EMIT
|
||||||
IncludeBlocks: Preserve
|
IncludeBlocks: Preserve
|
||||||
IncludeCategories:
|
IncludeCategories:
|
||||||
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
|
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
|
||||||
Priority: 2
|
Priority: 2
|
||||||
|
SortPriority: 0
|
||||||
|
CaseSensitive: false
|
||||||
- Regex: '^(<|"(gtest|isl|json)/)'
|
- Regex: '^(<|"(gtest|isl|json)/)'
|
||||||
Priority: 3
|
Priority: 3
|
||||||
|
SortPriority: 0
|
||||||
|
CaseSensitive: false
|
||||||
- Regex: '.*'
|
- Regex: '.*'
|
||||||
Priority: 1
|
Priority: 1
|
||||||
|
SortPriority: 0
|
||||||
|
CaseSensitive: false
|
||||||
IncludeIsMainRegex: '$'
|
IncludeIsMainRegex: '$'
|
||||||
|
IncludeIsMainSourceRegex: ''
|
||||||
IndentCaseLabels: false
|
IndentCaseLabels: false
|
||||||
|
IndentCaseBlocks: false
|
||||||
|
IndentGotoLabels: true
|
||||||
IndentPPDirectives: AfterHash
|
IndentPPDirectives: AfterHash
|
||||||
|
IndentExternBlock: AfterExternBlock
|
||||||
|
IndentRequires: false
|
||||||
IndentWidth: 2
|
IndentWidth: 2
|
||||||
IndentWrappedFunctionNames: false
|
IndentWrappedFunctionNames: false
|
||||||
|
InsertTrailingCommas: None
|
||||||
JavaScriptQuotes: Leave
|
JavaScriptQuotes: Leave
|
||||||
JavaScriptWrapImports: true
|
JavaScriptWrapImports: true
|
||||||
KeepEmptyLinesAtTheStartOfBlocks: true
|
KeepEmptyLinesAtTheStartOfBlocks: true
|
||||||
|
@ -86,6 +109,7 @@ MaxEmptyLinesToKeep: 1
|
||||||
NamespaceIndentation: None
|
NamespaceIndentation: None
|
||||||
ObjCBinPackProtocolList: Auto
|
ObjCBinPackProtocolList: Auto
|
||||||
ObjCBlockIndentWidth: 2
|
ObjCBlockIndentWidth: 2
|
||||||
|
ObjCBreakBeforeNestedBlockParam: true
|
||||||
ObjCSpaceAfterProperty: false
|
ObjCSpaceAfterProperty: false
|
||||||
ObjCSpaceBeforeProtocolList: true
|
ObjCSpaceBeforeProtocolList: true
|
||||||
PenaltyBreakAssignment: 2
|
PenaltyBreakAssignment: 2
|
||||||
|
@ -96,31 +120,46 @@ PenaltyBreakString: 1000
|
||||||
PenaltyBreakTemplateDeclaration: 10
|
PenaltyBreakTemplateDeclaration: 10
|
||||||
PenaltyExcessCharacter: 1000000
|
PenaltyExcessCharacter: 1000000
|
||||||
PenaltyReturnTypeOnItsOwnLine: 60
|
PenaltyReturnTypeOnItsOwnLine: 60
|
||||||
|
PenaltyIndentedWhitespace: 0
|
||||||
PointerAlignment: Right
|
PointerAlignment: Right
|
||||||
ReflowComments: true
|
ReflowComments: true
|
||||||
SortIncludes: false
|
SortIncludes: false
|
||||||
|
SortJavaStaticImport: Before
|
||||||
SortUsingDeclarations: true
|
SortUsingDeclarations: true
|
||||||
SpaceAfterCStyleCast: false
|
SpaceAfterCStyleCast: false
|
||||||
SpaceAfterLogicalNot: false
|
SpaceAfterLogicalNot: false
|
||||||
SpaceAfterTemplateKeyword: true
|
SpaceAfterTemplateKeyword: true
|
||||||
SpaceBeforeAssignmentOperators: true
|
SpaceBeforeAssignmentOperators: true
|
||||||
|
SpaceBeforeCaseColon: false
|
||||||
SpaceBeforeCpp11BracedList: false
|
SpaceBeforeCpp11BracedList: false
|
||||||
SpaceBeforeCtorInitializerColon: true
|
SpaceBeforeCtorInitializerColon: true
|
||||||
SpaceBeforeInheritanceColon: true
|
SpaceBeforeInheritanceColon: true
|
||||||
SpaceBeforeParens: ControlStatements
|
SpaceBeforeParens: ControlStatements
|
||||||
|
SpaceAroundPointerQualifiers: Default
|
||||||
SpaceBeforeRangeBasedForLoopColon: true
|
SpaceBeforeRangeBasedForLoopColon: true
|
||||||
|
SpaceInEmptyBlock: false
|
||||||
SpaceInEmptyParentheses: false
|
SpaceInEmptyParentheses: false
|
||||||
SpacesBeforeTrailingComments: 1
|
SpacesBeforeTrailingComments: 1
|
||||||
SpacesInAngles: false
|
SpacesInAngles: false
|
||||||
|
SpacesInConditionalStatement: false
|
||||||
SpacesInContainerLiterals: true
|
SpacesInContainerLiterals: true
|
||||||
SpacesInCStyleCastParentheses: false
|
SpacesInCStyleCastParentheses: false
|
||||||
SpacesInParentheses: false
|
SpacesInParentheses: false
|
||||||
SpacesInSquareBrackets: false
|
SpacesInSquareBrackets: false
|
||||||
Standard: Cpp11
|
SpaceBeforeSquareBrackets: false
|
||||||
|
BitFieldColonSpacing: Both
|
||||||
|
Standard: Latest
|
||||||
StatementMacros:
|
StatementMacros:
|
||||||
- Q_UNUSED
|
- Q_UNUSED
|
||||||
- QT_REQUIRE_VERSION
|
- QT_REQUIRE_VERSION
|
||||||
TabWidth: 8
|
TabWidth: 8
|
||||||
|
UseCRLF: false
|
||||||
UseTab: Never
|
UseTab: Never
|
||||||
|
WhitespaceSensitiveMacros:
|
||||||
|
- STRINGIZE
|
||||||
|
- PP_STRINGIZE
|
||||||
|
- BOOST_PP_STRINGIZE
|
||||||
|
- NS_SWIFT_NAME
|
||||||
|
- CF_SWIFT_NAME
|
||||||
...
|
...
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ Coding style
|
||||||
We use clang-format to format source code consistently. The
|
We use clang-format to format source code consistently. The
|
||||||
clang-format configuration file .clang-format is located at the root
|
clang-format configuration file .clang-format is located at the root
|
||||||
directory. Since clang-format produces slightly different results
|
directory. Since clang-format produces slightly different results
|
||||||
between versions, we currently use clang-format-10.
|
between versions, we currently use clang-format-12.
|
||||||
|
|
||||||
To detect any violation to the coding style, we recommend to setup git
|
To detect any violation to the coding style, we recommend to setup git
|
||||||
pre-commit hook to check coding style of the changes you introduced.
|
pre-commit hook to check coding style of the changes you introduced.
|
||||||
|
@ -34,7 +34,7 @@ The pre-commit file is located at the root directory. Copy it under
|
||||||
.git/hooks and make sure that it is executable. The pre-commit script
|
.git/hooks and make sure that it is executable. The pre-commit script
|
||||||
uses clang-format-diff.py to detect any style errors. If it is not in
|
uses clang-format-diff.py to detect any style errors. If it is not in
|
||||||
your PATH or it exists under different name (e.g.,
|
your PATH or it exists under different name (e.g.,
|
||||||
clang-format-diff-10 in debian), either add it to PATH variable or add
|
clang-format-diff-12 in debian), either add it to PATH variable or add
|
||||||
git option ``clangformatdiff.binary`` to point to the script.
|
git option ``clangformatdiff.binary`` to point to the script.
|
||||||
|
|
||||||
For emacs users, integrating clang-format to emacs is very easy.
|
For emacs users, integrating clang-format to emacs is very easy.
|
||||||
|
|
|
@ -6430,8 +6430,9 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in,
|
||||||
|
|
||||||
/* CONTINUATION won't bear NGHTTP2_PADDED flag */
|
/* CONTINUATION won't bear NGHTTP2_PADDED flag */
|
||||||
|
|
||||||
iframe->frame.hd.flags = (uint8_t)(
|
iframe->frame.hd.flags =
|
||||||
iframe->frame.hd.flags | (cont_hd.flags & NGHTTP2_FLAG_END_HEADERS));
|
(uint8_t)(iframe->frame.hd.flags |
|
||||||
|
(cont_hd.flags & NGHTTP2_FLAG_END_HEADERS));
|
||||||
iframe->frame.hd.length += cont_hd.length;
|
iframe->frame.hd.length += cont_hd.length;
|
||||||
|
|
||||||
busy = 1;
|
busy = 1;
|
||||||
|
|
|
@ -198,9 +198,9 @@ StringRef Request::get_real_host() const {
|
||||||
|
|
||||||
uint16_t Request::get_real_port() const {
|
uint16_t Request::get_real_port() const {
|
||||||
auto scheme = get_real_scheme();
|
auto scheme = get_real_scheme();
|
||||||
return config.host_override.empty()
|
return config.host_override.empty() ? util::has_uri_field(u, UF_PORT) ? u.port
|
||||||
? util::has_uri_field(u, UF_PORT) ? u.port
|
: scheme == "https" ? 443
|
||||||
: scheme == "https" ? 443 : 80
|
: 80
|
||||||
: config.port_override == 0 ? scheme == "https" ? 443 : 80
|
: config.port_override == 0 ? scheme == "https" ? 443 : 80
|
||||||
: config.port_override;
|
: config.port_override;
|
||||||
}
|
}
|
||||||
|
@ -1681,8 +1681,9 @@ void update_html_parser(HttpClient *client, Request *req, const uint8_t *data,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto link_port =
|
auto link_port = util::has_uri_field(u, UF_PORT) ? u.port
|
||||||
util::has_uri_field(u, UF_PORT) ? u.port : scheme == "https" ? 443 : 80;
|
: scheme == "https" ? 443
|
||||||
|
: 80;
|
||||||
|
|
||||||
if (port != link_port) {
|
if (port != link_port) {
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -1070,8 +1070,7 @@ Http2Upstream::Http2Upstream(ClientHandler *handler)
|
||||||
<< nghttp2_strerror(rv);
|
<< nghttp2_strerror(rv);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto window_size =
|
auto window_size = faddr->alt_mode != UpstreamAltMode::NONE
|
||||||
faddr->alt_mode != UpstreamAltMode::NONE
|
|
||||||
? std::numeric_limits<int32_t>::max()
|
? std::numeric_limits<int32_t>::max()
|
||||||
: http2conf.upstream.optimize_window_size
|
: http2conf.upstream.optimize_window_size
|
||||||
? std::min(http2conf.upstream.connection_window_size,
|
? std::min(http2conf.upstream.connection_window_size,
|
||||||
|
|
|
@ -595,12 +595,10 @@ void upstream_accesslog(const std::vector<LogFragment> &lfv,
|
||||||
auto downstream_addr = downstream->get_addr();
|
auto downstream_addr = downstream->get_addr();
|
||||||
auto method = req.method == -1 ? StringRef::from_lit("<unknown>")
|
auto method = req.method == -1 ? StringRef::from_lit("<unknown>")
|
||||||
: http2::to_method_string(req.method);
|
: http2::to_method_string(req.method);
|
||||||
auto path = req.method == HTTP_CONNECT
|
auto path =
|
||||||
? req.authority
|
req.method == HTTP_CONNECT ? req.authority
|
||||||
: config->http2_proxy
|
: config->http2_proxy ? construct_absolute_request_uri(balloc, req)
|
||||||
? construct_absolute_request_uri(balloc, req)
|
: req.path.empty() ? req.method == HTTP_OPTIONS ? StringRef::from_lit("*")
|
||||||
: req.path.empty() ? req.method == HTTP_OPTIONS
|
|
||||||
? StringRef::from_lit("*")
|
|
||||||
: StringRef::from_lit("-")
|
: StringRef::from_lit("-")
|
||||||
: req.path;
|
: req.path;
|
||||||
auto path_without_query =
|
auto path_without_query =
|
||||||
|
|
Loading…
Reference in New Issue