clang-format-12
This commit is contained in:
parent
31253f400d
commit
29cbf8b83f
|
@ -2,16 +2,18 @@
|
|||
Language: Cpp
|
||||
AccessModifierOffset: -2
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignConsecutiveMacros: false
|
||||
AlignConsecutiveAssignments: false
|
||||
AlignConsecutiveDeclarations: false
|
||||
AlignConsecutiveMacros: None
|
||||
AlignConsecutiveAssignments: None
|
||||
AlignConsecutiveBitFields: None
|
||||
AlignConsecutiveDeclarations: None
|
||||
AlignEscapedNewlines: Right
|
||||
AlignOperands: true
|
||||
AlignOperands: Align
|
||||
AlignTrailingComments: true
|
||||
AllowAllArgumentsOnNextLine: true
|
||||
AllowAllConstructorInitializersOnNextLine: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: true
|
||||
AllowShortBlocksOnASingleLine: false
|
||||
AllowShortEnumsOnASingleLine: true
|
||||
AllowShortBlocksOnASingleLine: Never
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: All
|
||||
AllowShortLambdasOnASingleLine: All
|
||||
|
@ -21,12 +23,14 @@ AlwaysBreakAfterDefinitionReturnType: None
|
|||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: false
|
||||
AlwaysBreakTemplateDeclarations: MultiLine
|
||||
AttributeMacros:
|
||||
- __capability
|
||||
BinPackArguments: true
|
||||
BinPackParameters: true
|
||||
BraceWrapping:
|
||||
AfterCaseLabel: false
|
||||
AfterClass: false
|
||||
AfterControlStatement: false
|
||||
AfterControlStatement: Never
|
||||
AfterEnum: false
|
||||
AfterFunction: false
|
||||
AfterNamespace: false
|
||||
|
@ -36,11 +40,14 @@ BraceWrapping:
|
|||
AfterExternBlock: false
|
||||
BeforeCatch: false
|
||||
BeforeElse: false
|
||||
BeforeLambdaBody: false
|
||||
BeforeWhile: false
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: true
|
||||
SplitEmptyRecord: true
|
||||
SplitEmptyNamespace: true
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeConceptDeclarations: true
|
||||
BreakBeforeBraces: Attach
|
||||
BreakBeforeInheritanceComma: false
|
||||
BreakInheritanceList: BeforeColon
|
||||
|
@ -56,27 +63,43 @@ ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
|||
ConstructorInitializerIndentWidth: 4
|
||||
ContinuationIndentWidth: 4
|
||||
Cpp11BracedListStyle: true
|
||||
DeriveLineEnding: true
|
||||
DerivePointerAlignment: false
|
||||
DisableFormat: false
|
||||
EmptyLineBeforeAccessModifier: LogicalBlock
|
||||
ExperimentalAutoDetectBinPacking: false
|
||||
FixNamespaceComments: true
|
||||
ForEachMacros:
|
||||
- foreach
|
||||
- Q_FOREACH
|
||||
- BOOST_FOREACH
|
||||
StatementAttributeLikeMacros:
|
||||
- Q_EMIT
|
||||
IncludeBlocks: Preserve
|
||||
IncludeCategories:
|
||||
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
|
||||
Priority: 2
|
||||
SortPriority: 0
|
||||
CaseSensitive: false
|
||||
- Regex: '^(<|"(gtest|isl|json)/)'
|
||||
Priority: 3
|
||||
SortPriority: 0
|
||||
CaseSensitive: false
|
||||
- Regex: '.*'
|
||||
Priority: 1
|
||||
SortPriority: 0
|
||||
CaseSensitive: false
|
||||
IncludeIsMainRegex: '$'
|
||||
IncludeIsMainSourceRegex: ''
|
||||
IndentCaseLabels: false
|
||||
IndentCaseBlocks: false
|
||||
IndentGotoLabels: true
|
||||
IndentPPDirectives: AfterHash
|
||||
IndentExternBlock: AfterExternBlock
|
||||
IndentRequires: false
|
||||
IndentWidth: 2
|
||||
IndentWrappedFunctionNames: false
|
||||
InsertTrailingCommas: None
|
||||
JavaScriptQuotes: Leave
|
||||
JavaScriptWrapImports: true
|
||||
KeepEmptyLinesAtTheStartOfBlocks: true
|
||||
|
@ -86,6 +109,7 @@ MaxEmptyLinesToKeep: 1
|
|||
NamespaceIndentation: None
|
||||
ObjCBinPackProtocolList: Auto
|
||||
ObjCBlockIndentWidth: 2
|
||||
ObjCBreakBeforeNestedBlockParam: true
|
||||
ObjCSpaceAfterProperty: false
|
||||
ObjCSpaceBeforeProtocolList: true
|
||||
PenaltyBreakAssignment: 2
|
||||
|
@ -96,31 +120,46 @@ PenaltyBreakString: 1000
|
|||
PenaltyBreakTemplateDeclaration: 10
|
||||
PenaltyExcessCharacter: 1000000
|
||||
PenaltyReturnTypeOnItsOwnLine: 60
|
||||
PenaltyIndentedWhitespace: 0
|
||||
PointerAlignment: Right
|
||||
ReflowComments: true
|
||||
SortIncludes: false
|
||||
SortJavaStaticImport: Before
|
||||
SortUsingDeclarations: true
|
||||
SpaceAfterCStyleCast: false
|
||||
SpaceAfterLogicalNot: false
|
||||
SpaceAfterTemplateKeyword: true
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeCaseColon: false
|
||||
SpaceBeforeCpp11BracedList: false
|
||||
SpaceBeforeCtorInitializerColon: true
|
||||
SpaceBeforeInheritanceColon: true
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceAroundPointerQualifiers: Default
|
||||
SpaceBeforeRangeBasedForLoopColon: true
|
||||
SpaceInEmptyBlock: false
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 1
|
||||
SpacesInAngles: false
|
||||
SpacesInConditionalStatement: false
|
||||
SpacesInContainerLiterals: true
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
Standard: Cpp11
|
||||
SpaceBeforeSquareBrackets: false
|
||||
BitFieldColonSpacing: Both
|
||||
Standard: Latest
|
||||
StatementMacros:
|
||||
- Q_UNUSED
|
||||
- QT_REQUIRE_VERSION
|
||||
TabWidth: 8
|
||||
UseCRLF: false
|
||||
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
|
||||
clang-format configuration file .clang-format is located at the root
|
||||
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
|
||||
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
|
||||
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.,
|
||||
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.
|
||||
|
||||
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 */
|
||||
|
||||
iframe->frame.hd.flags = (uint8_t)(
|
||||
iframe->frame.hd.flags | (cont_hd.flags & NGHTTP2_FLAG_END_HEADERS));
|
||||
iframe->frame.hd.flags =
|
||||
(uint8_t)(iframe->frame.hd.flags |
|
||||
(cont_hd.flags & NGHTTP2_FLAG_END_HEADERS));
|
||||
iframe->frame.hd.length += cont_hd.length;
|
||||
|
||||
busy = 1;
|
||||
|
|
|
@ -198,9 +198,9 @@ StringRef Request::get_real_host() const {
|
|||
|
||||
uint16_t Request::get_real_port() const {
|
||||
auto scheme = get_real_scheme();
|
||||
return config.host_override.empty()
|
||||
? util::has_uri_field(u, UF_PORT) ? u.port
|
||||
: scheme == "https" ? 443 : 80
|
||||
return config.host_override.empty() ? util::has_uri_field(u, UF_PORT) ? u.port
|
||||
: scheme == "https" ? 443
|
||||
: 80
|
||||
: config.port_override == 0 ? scheme == "https" ? 443 : 80
|
||||
: config.port_override;
|
||||
}
|
||||
|
@ -1681,8 +1681,9 @@ void update_html_parser(HttpClient *client, Request *req, const uint8_t *data,
|
|||
continue;
|
||||
}
|
||||
|
||||
auto link_port =
|
||||
util::has_uri_field(u, UF_PORT) ? u.port : scheme == "https" ? 443 : 80;
|
||||
auto link_port = util::has_uri_field(u, UF_PORT) ? u.port
|
||||
: scheme == "https" ? 443
|
||||
: 80;
|
||||
|
||||
if (port != link_port) {
|
||||
continue;
|
||||
|
|
|
@ -1070,8 +1070,7 @@ Http2Upstream::Http2Upstream(ClientHandler *handler)
|
|||
<< nghttp2_strerror(rv);
|
||||
}
|
||||
|
||||
auto window_size =
|
||||
faddr->alt_mode != UpstreamAltMode::NONE
|
||||
auto window_size = faddr->alt_mode != UpstreamAltMode::NONE
|
||||
? std::numeric_limits<int32_t>::max()
|
||||
: http2conf.upstream.optimize_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 method = req.method == -1 ? StringRef::from_lit("<unknown>")
|
||||
: http2::to_method_string(req.method);
|
||||
auto path = req.method == HTTP_CONNECT
|
||||
? req.authority
|
||||
: config->http2_proxy
|
||||
? construct_absolute_request_uri(balloc, req)
|
||||
: req.path.empty() ? req.method == HTTP_OPTIONS
|
||||
? StringRef::from_lit("*")
|
||||
auto path =
|
||||
req.method == HTTP_CONNECT ? req.authority
|
||||
: config->http2_proxy ? construct_absolute_request_uri(balloc, req)
|
||||
: req.path.empty() ? req.method == HTTP_OPTIONS ? StringRef::from_lit("*")
|
||||
: StringRef::from_lit("-")
|
||||
: req.path;
|
||||
auto path_without_query =
|
||||
|
|
Loading…
Reference in New Issue