Update clang-format to 10.0 (#7389)
This commit removes our local copy of clang-format 8 and replaces it with a newly-built nuget package containing clang-format 10. This resolves the inconsistency between our version of clang-format and the one shipped in Visual Studio. A couple minor format changes were either required or erroneously forced upon us--chief among them is a redistribution of `*`s around SAL annotations in inline class members of COM classes. Don't ask why; I couldn't figure it out. We had some aspirational goals for our formatting, which were left in but commented out. Enabling them changes our format a little more than I'm comfortable with, so I uncommented them and locked them to the format style we've been using for the past year. We may not love it, but our aspirations may not matter here any longer. Consistent formatting is better than perfect formatting.
This commit is contained in:
parent
6acb9f8c90
commit
dbbe820ae4
|
@ -1,17 +1,19 @@
|
||||||
|
|
||||||
AccessModifierOffset: -4
|
AccessModifierOffset: -4
|
||||||
AlignAfterOpenBracket: Align
|
AlignAfterOpenBracket: Align
|
||||||
#AllowAllArgumentsOnNextLine: false
|
AllowAllArgumentsOnNextLine: true
|
||||||
|
AlignConsecutiveMacros: false
|
||||||
AlignConsecutiveAssignments: false
|
AlignConsecutiveAssignments: false
|
||||||
AlignConsecutiveDeclarations: false
|
AlignConsecutiveDeclarations: false
|
||||||
#AllowAllConstructorInitializersOnNextLine: false
|
AllowAllConstructorInitializersOnNextLine: true
|
||||||
AlignEscapedNewlines: Left
|
AlignEscapedNewlines: Left
|
||||||
AlignOperands: true
|
AlignOperands: true
|
||||||
AlignTrailingComments: false
|
AlignTrailingComments: false
|
||||||
AllowAllParametersOfDeclarationOnNextLine: false
|
AllowAllParametersOfDeclarationOnNextLine: false
|
||||||
|
AllowShortBlocksOnASingleLine: Never
|
||||||
AllowShortFunctionsOnASingleLine: Inline
|
AllowShortFunctionsOnASingleLine: Inline
|
||||||
AllowShortCaseLabelsOnASingleLine: false
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
AllowShortIfStatementsOnASingleLine: false
|
AllowShortIfStatementsOnASingleLine: Never
|
||||||
#AllowShortLambdasOnASingleLine: Inline
|
#AllowShortLambdasOnASingleLine: Inline
|
||||||
AllowShortLoopsOnASingleLine: false
|
AllowShortLoopsOnASingleLine: false
|
||||||
AlwaysBreakAfterReturnType: None
|
AlwaysBreakAfterReturnType: None
|
||||||
|
@ -20,6 +22,7 @@ AlwaysBreakTemplateDeclarations: Yes
|
||||||
BinPackArguments: false
|
BinPackArguments: false
|
||||||
BinPackParameters: false
|
BinPackParameters: false
|
||||||
BraceWrapping:
|
BraceWrapping:
|
||||||
|
AfterCaseLabel: true
|
||||||
AfterClass: true
|
AfterClass: true
|
||||||
AfterControlStatement: true
|
AfterControlStatement: true
|
||||||
AfterEnum: true
|
AfterEnum: true
|
||||||
|
@ -47,6 +50,7 @@ ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
||||||
ConstructorInitializerIndentWidth: 4
|
ConstructorInitializerIndentWidth: 4
|
||||||
ContinuationIndentWidth: 4
|
ContinuationIndentWidth: 4
|
||||||
Cpp11BracedListStyle: false
|
Cpp11BracedListStyle: false
|
||||||
|
DeriveLineEnding: true
|
||||||
DerivePointerAlignment: false
|
DerivePointerAlignment: false
|
||||||
FixNamespaceComments: false
|
FixNamespaceComments: false
|
||||||
IncludeBlocks: Regroup
|
IncludeBlocks: Regroup
|
||||||
|
@ -73,7 +77,7 @@ ReflowComments: false
|
||||||
SortIncludes: false
|
SortIncludes: false
|
||||||
SortUsingDeclarations: true
|
SortUsingDeclarations: true
|
||||||
SpaceAfterCStyleCast: false
|
SpaceAfterCStyleCast: false
|
||||||
#SpaceAfterLogicalNot: false
|
SpaceAfterLogicalNot: false
|
||||||
SpaceAfterTemplateKeyword: false
|
SpaceAfterTemplateKeyword: false
|
||||||
SpaceBeforeAssignmentOperators: true
|
SpaceBeforeAssignmentOperators: true
|
||||||
SpaceBeforeCpp11BracedList: false
|
SpaceBeforeCpp11BracedList: false
|
||||||
|
@ -88,6 +92,6 @@ SpacesInCStyleCastParentheses: false
|
||||||
SpacesInContainerLiterals: false
|
SpacesInContainerLiterals: false
|
||||||
SpacesInParentheses: false
|
SpacesInParentheses: false
|
||||||
SpacesInSquareBrackets: false
|
SpacesInSquareBrackets: false
|
||||||
Standard: Cpp11
|
Standard: Latest
|
||||||
TabWidth: 4
|
TabWidth: 4
|
||||||
UseTab: Never
|
UseTab: Never
|
||||||
|
|
Binary file not shown.
|
@ -1488,8 +1488,7 @@ try
|
||||||
const D2D_POINT_2F target = { coordTarget.X * font.width, coordTarget.Y * font.height };
|
const D2D_POINT_2F target = { coordTarget.X * font.width, coordTarget.Y * font.height };
|
||||||
const auto fullRunWidth = font.width * gsl::narrow_cast<unsigned>(cchLine);
|
const auto fullRunWidth = font.width * gsl::narrow_cast<unsigned>(cchLine);
|
||||||
|
|
||||||
const auto DrawLine = [=](const auto x0, const auto y0, const auto x1, const auto y1, const auto strokeWidth) noexcept
|
const auto DrawLine = [=](const auto x0, const auto y0, const auto x1, const auto y1, const auto strokeWidth) noexcept {
|
||||||
{
|
|
||||||
_d2dDeviceContext->DrawLine({ x0, y0 }, { x1, y1 }, _d2dBrushForeground.Get(), strokeWidth, _strokeStyle.Get());
|
_d2dDeviceContext->DrawLine({ x0, y0 }, { x1, y1 }, _d2dBrushForeground.Get(), strokeWidth, _strokeStyle.Get());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -588,8 +588,7 @@ bool TerminalInput::HandleKey(const IInputEvent* const pInEvent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto senderFunc = [this](const std::wstring_view seq) noexcept
|
const auto senderFunc = [this](const std::wstring_view seq) noexcept {
|
||||||
{
|
|
||||||
_SendInputSequence(seq);
|
_SendInputSequence(seq);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -323,7 +323,10 @@ function Invoke-ClangFormat {
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
Param (
|
Param (
|
||||||
[Parameter(Mandatory=$true,ValueFromPipeline=$true)]
|
[Parameter(Mandatory=$true,ValueFromPipeline=$true)]
|
||||||
[string[]]$Path
|
[string[]]$Path,
|
||||||
|
|
||||||
|
[Parameter(Mandatory=$false)]
|
||||||
|
[string]$ClangFormatPath = "clang-format" # (whichever one is in $PATH)
|
||||||
)
|
)
|
||||||
|
|
||||||
Begin {
|
Begin {
|
||||||
|
@ -340,7 +343,7 @@ function Invoke-ClangFormat {
|
||||||
End {
|
End {
|
||||||
For($i = [int]0; $i -Lt $Paths.Length; $i += $BatchSize) {
|
For($i = [int]0; $i -Lt $Paths.Length; $i += $BatchSize) {
|
||||||
Try {
|
Try {
|
||||||
& "$env:OpenconsoleRoot/dep/llvm/clang-format" -i $Paths[$i .. ($i + $BatchSize - 1)]
|
& $ClangFormatPath -i $Paths[$i .. ($i + $BatchSize - 1)]
|
||||||
} Catch {
|
} Catch {
|
||||||
Write-Error $_
|
Write-Error $_
|
||||||
}
|
}
|
||||||
|
@ -351,9 +354,12 @@ function Invoke-ClangFormat {
|
||||||
#.SYNOPSIS
|
#.SYNOPSIS
|
||||||
# runs code formatting on all c++ files
|
# runs code formatting on all c++ files
|
||||||
function Invoke-CodeFormat() {
|
function Invoke-CodeFormat() {
|
||||||
|
& "$env:OpenConsoleRoot\dep\nuget\nuget.exe" restore "$env:OpenConsoleRoot\tools\packages.config"
|
||||||
|
$clangPackage = ([xml](Get-Content "$env:OpenConsoleRoot\tools\packages.config")).packages.package | Where-Object id -like "clang-format*"
|
||||||
|
$clangFormatPath = "$env:OpenConsoleRoot\packages\$($clangPackage.id).$($clangPackage.version)\tools\clang-format.exe"
|
||||||
Get-ChildItem -Recurse "$env:OpenConsoleRoot/src" -Include *.cpp, *.hpp, *.h |
|
Get-ChildItem -Recurse "$env:OpenConsoleRoot/src" -Include *.cpp, *.hpp, *.h |
|
||||||
Where FullName -NotLike "*Generated Files*" |
|
Where FullName -NotLike "*Generated Files*" |
|
||||||
Invoke-ClangFormat
|
Invoke-ClangFormat -ClangFormatPath $clangFormatPath
|
||||||
}
|
}
|
||||||
|
|
||||||
Export-ModuleMember -Function Set-MsbuildDevEnvironment,Invoke-OpenConsoleTests,Invoke-OpenConsoleBuild,Start-OpenConsole,Debug-OpenConsole,Invoke-CodeFormat
|
Export-ModuleMember -Function Set-MsbuildDevEnvironment,Invoke-OpenConsoleTests,Invoke-OpenConsoleBuild,Start-OpenConsole,Debug-OpenConsole,Invoke-CodeFormat
|
||||||
|
|
4
tools/packages.config
Normal file
4
tools/packages.config
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="clang-format.win-x86" version="10.0.0" targetFramework="native" />
|
||||||
|
</packages>
|
Loading…
Reference in a new issue