Skip to content

Commit 862c82f

Browse files
Update JIT sources to clang-format/clang-tidy 17.0.6 (#100498)
* Update JIT sources to clang-format/clang-tidy 17.0.6 * Reformat * Reformat x86
1 parent f558631 commit 862c82f

File tree

180 files changed

+4572
-3622
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

180 files changed

+4572
-3622
lines changed

eng/formatting/download-tools.ps1

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,25 @@ function DownloadClangTool {
88
$downloadOutputPath
99
)
1010

11-
$baseUri = "https://clrjit.blob.core.windows.net/clang-tools/windows"
11+
$clangVersion = "17.0.6"
12+
$clangToolsRootUrl = "https://clrjit2.blob.core.windows.net/clang-tools"
13+
$clangPlatform = "windows-x64"
14+
15+
$toolUrl = "$clangToolsRootUrl/$clangVersion/$clangPlatform/$toolName.exe"
16+
$targetPath = "$downloadOutputPath\$toolName.exe"
1217

1318
if (-not $(ls $downloadOutputPath | Where-Object { $_.Name -eq "$toolName.exe" })) {
1419

1520
Retry({
16-
Write-Output "Downloading '$baseUri/$toolName.exe'"
21+
Write-Output "Downloading '$toolUrl' to '$targetPath'"
1722
# Pass -PassThru as otherwise Invoke-WebRequest leaves a corrupted file if the download fails. With -PassThru the download is buffered first.
1823
# -UseBasicParsing is necessary for older PowerShells when Internet Explorer might not be installed/configured
19-
$null = Invoke-WebRequest -Uri "$baseUri/$toolName.exe" -OutFile $(Join-Path $downloadOutputPath -ChildPath "$toolName.exe") -PassThru -UseBasicParsing
24+
$null = Invoke-WebRequest -Uri "$toolUrl" -OutFile $(Join-Path $downloadOutputPath -ChildPath "$toolName.exe") -PassThru -UseBasicParsing
2025
})
2126
}
27+
else {
28+
Write-Output "Found '$targetPath'"
29+
}
2230
}
2331

2432
$downloadPathFolder = Split-Path $PSScriptRoot -Parent | Split-Path -Parent | Join-Path -ChildPath "artifacts" | Join-Path -ChildPath "tools"

eng/formatting/download-tools.sh

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,22 @@ done
1515
scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
1616

1717
function DownloadClangTool {
18-
targetPlatform=$(dotnet --info |grep RID:)
19-
targetPlatform=${targetPlatform##*RID:* }
20-
echo "dotnet RID: ${targetPlatform}"
18+
19+
clangVersion="17.0.6"
20+
clangToolsRootUrl="https://clrjit2.blob.core.windows.net/clang-tools"
21+
22+
clangPlatform="$(dotnet --info | grep 'RID:')"
23+
clangPlatform="${clangPlatform##*RID:* }"
24+
echo "dotnet RID: ${clangPlatform}"
2125

2226
# override common RIDs with compatible version so we don't need to upload binaries for each RID
23-
case $targetPlatform in
24-
osx.*-x64)
25-
targetPlatform=osx.10.15-x64
26-
;;
27+
case $clangPlatform in
2728
ubuntu.*-x64)
28-
targetPlatform=ubuntu.18.04-x64
29-
;;
29+
clangPlatform=linux-x64
30+
;;
3031
esac
3132

32-
toolUrl=https://clrjit.blob.core.windows.net/clang-tools/${targetPlatform}/$1
33+
toolUrl="${clangToolsRootUrl}/${clangVersion}/${clangPlatform}/$1"
3334
toolOutput=$2/$1
3435

3536
echo "Downloading $1 from ${toolUrl} to ${toolOutput}"

eng/pipelines/coreclr/templates/format-job.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ jobs:
4848
displayName: 'Install .NET SDK'
4949
inputs:
5050
packageType: 'sdk'
51-
version: '6.x'
52-
includePreviewVersions: true
51+
version: '8.x'
5352
installationPath: $(Agent.ToolsDirectory)/dotnet
5453

5554
- script: $(PythonSetupScript)

src/coreclr/jit/.clang-format

Lines changed: 85 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,131 @@
11
---
2-
Language: Cpp
2+
Language: Cpp
33
AccessModifierOffset: -4
44
AlignAfterOpenBracket: Align
5-
AlignConsecutiveAssignments: true
6-
AlignConsecutiveDeclarations: true
7-
AlignEscapedNewlinesLeft: false
8-
AlignOperands: true
9-
AlignTrailingComments: true
5+
6+
AlignConsecutiveAssignments:
7+
Enabled: true
8+
AcrossEmptyLines: false
9+
AcrossComments: false
10+
AlignCompound: false
11+
PadOperators: true
12+
13+
AlignConsecutiveBitFields:
14+
Enabled: true
15+
AcrossEmptyLines: false
16+
AcrossComments: false
17+
18+
AlignConsecutiveDeclarations:
19+
Enabled: true
20+
AcrossEmptyLines: false
21+
AcrossComments: false
22+
23+
AlignConsecutiveMacros:
24+
Enabled: true
25+
AcrossEmptyLines: false
26+
AcrossComments: false
27+
28+
AlignEscapedNewlines: Right
29+
AlignOperands: true
30+
31+
AlignTrailingComments:
32+
Kind: Always
33+
OverEmptyLines: 0
34+
35+
AllowAllArgumentsOnNextLine: true
1036
AllowAllParametersOfDeclarationOnNextLine: true
11-
AllowShortBlocksOnASingleLine: false
37+
AllowShortBlocksOnASingleLine: Never
1238
AllowShortCaseLabelsOnASingleLine: false
13-
AllowShortFunctionsOnASingleLine: Empty
14-
AllowShortIfStatementsOnASingleLine: false
39+
AllowShortEnumsOnASingleLine: false
40+
AllowShortFunctionsOnASingleLine: None
41+
AllowShortIfStatementsOnASingleLine: Never
42+
AllowShortLambdasOnASingleLine: Empty
1543
AllowShortLoopsOnASingleLine: false
1644
AlwaysBreakAfterDefinitionReturnType: None
1745
AlwaysBreakBeforeMultilineStrings: false
1846
AlwaysBreakTemplateDeclarations: true
1947
BinPackArguments: true
2048
BinPackParameters: false
49+
50+
BreakBeforeBraces: Custom
2151
BraceWrapping:
22-
AfterClass: true
23-
AfterControlStatement: true
24-
AfterEnum: false
25-
AfterFunction: true
26-
AfterNamespace: false
27-
AfterObjCDeclaration: false
28-
AfterStruct: true
29-
AfterUnion: true
30-
BeforeCatch: true
31-
BeforeElse: true
32-
IndentBraces: false
52+
AfterCaseLabel: true
53+
AfterClass: true
54+
AfterControlStatement: Always
55+
AfterEnum: true
56+
AfterFunction: true
57+
AfterNamespace: true
58+
AfterStruct: true
59+
AfterUnion: true
60+
AfterExternBlock: true
61+
BeforeCatch: true
62+
BeforeElse: true
63+
BeforeLambdaBody: false
64+
BeforeWhile: false
65+
IndentBraces: false
66+
SplitEmptyFunction: true
67+
SplitEmptyRecord: true
68+
SplitEmptyNamespace: true
69+
3370
BreakBeforeBinaryOperators: None
34-
BreakBeforeBraces: Allman
3571
BreakBeforeTernaryOperators: true
36-
BreakConstructorInitializersBeforeComma: true
37-
ColumnLimit: 120
38-
CommentPragmas: '^ IWYU pragma:'
39-
ConstructorInitializerAllOnOneLineOrOnePerLine: true
72+
BreakConstructorInitializers: BeforeComma
73+
BreakInheritanceList: BeforeComma
74+
BreakStringLiterals: false
75+
76+
ColumnLimit: 120
77+
CommentPragmas: '^ IWYU pragma:'
78+
CompactNamespaces: false
4079
ConstructorInitializerIndentWidth: 4
4180
ContinuationIndentWidth: 4
4281
Cpp11BracedListStyle: true
4382
DerivePointerAlignment: false
44-
DisableFormat: false
83+
DisableFormat: false
84+
85+
EmptyLineAfterAccessModifier: Leave
86+
EmptyLineBeforeAccessModifier: Leave
4587
ExperimentalAutoDetectBinPacking: false
46-
ForEachMacros: [ ]
88+
ForEachMacros: [ ]
89+
IndentAccessModifiers: false
90+
IndentCaseBlocks: false
4791
IndentCaseLabels: true
48-
IndentWidth: 4
92+
IndentExternBlock: false
93+
IndentGotoLabels: true
94+
IndentPPDirectives: None
95+
IndentWidth: 4
4996
IndentWrappedFunctionNames: false
97+
98+
InsertNewlineAtEOF: true
5099
KeepEmptyLinesAtTheStartOfBlocks: true
100+
LambdaBodyIndentation: OuterScope
51101
MacroBlockBegin: ''
52102
MacroBlockEnd: ''
53103
MaxEmptyLinesToKeep: 1
54104
NamespaceIndentation: None
55-
ObjCBlockIndentWidth: 2
56-
ObjCSpaceAfterProperty: false
57-
ObjCSpaceBeforeProtocolList: true
105+
58106
PenaltyBreakBeforeFirstCallParameter: 400
59107
PenaltyBreakComment: 50
60108
PenaltyBreakFirstLessLess: 500
61109
PenaltyBreakString: 1000
62110
PenaltyExcessCharacter: 1000000
63111
PenaltyReturnTypeOnItsOwnLine: 100000
112+
64113
PointerAlignment: Left
65114
ReflowComments: true
66-
SortIncludes: false
115+
SortIncludes: Never
116+
67117
SpaceAfterCStyleCast: false
68118
SpaceBeforeAssignmentOperators: true
69119
SpaceBeforeParens: ControlStatements
70120
SpaceInEmptyParentheses: false
71121
SpacesBeforeTrailingComments: 1
72-
SpacesInAngles: false
122+
SpacesInAngles: false
73123
SpacesInContainerLiterals: true
74124
SpacesInCStyleCastParentheses: false
75125
SpacesInParentheses: false
76126
SpacesInSquareBrackets: false
77-
Standard: Cpp11
127+
128+
Standard: Latest
78129
TabWidth: 4
79130
UseTab: Never
80131
...

src/coreclr/jit/_typeinfo.h

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,25 +41,34 @@ class typeInfo
4141
private:
4242
var_types m_type;
4343

44-
union {
44+
union
45+
{
4546
CORINFO_CLASS_HANDLE m_cls; // Valid, but not always available, for TYP_REFs.
4647
methodPointerInfo* m_methodPointerInfo; // Valid only for function pointers.
4748
};
4849

4950
public:
50-
typeInfo() : m_type(TYP_UNDEF), m_cls(NO_CLASS_HANDLE)
51+
typeInfo()
52+
: m_type(TYP_UNDEF)
53+
, m_cls(NO_CLASS_HANDLE)
5154
{
5255
}
5356

54-
typeInfo(var_types type) : m_type(type), m_cls(NO_CLASS_HANDLE)
57+
typeInfo(var_types type)
58+
: m_type(type)
59+
, m_cls(NO_CLASS_HANDLE)
5560
{
5661
}
5762

58-
typeInfo(CORINFO_CLASS_HANDLE cls) : m_type(TYP_REF), m_cls(cls)
63+
typeInfo(CORINFO_CLASS_HANDLE cls)
64+
: m_type(TYP_REF)
65+
, m_cls(cls)
5966
{
6067
}
6168

62-
typeInfo(methodPointerInfo* methodPointerInfo) : m_type(TYP_I_IMPL), m_methodPointerInfo(methodPointerInfo)
69+
typeInfo(methodPointerInfo* methodPointerInfo)
70+
: m_type(TYP_I_IMPL)
71+
, m_methodPointerInfo(methodPointerInfo)
6372
{
6473
assert(methodPointerInfo != nullptr);
6574
assert(methodPointerInfo->m_token.hMethod != nullptr);

src/coreclr/jit/abi.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ class RegisterQueue
6363
unsigned int m_index = 0;
6464

6565
public:
66-
RegisterQueue(const regNumber* regs, unsigned int numRegs) : m_regs(regs), m_numRegs(numRegs)
66+
RegisterQueue(const regNumber* regs, unsigned int numRegs)
67+
: m_regs(regs)
68+
, m_numRegs(numRegs)
6769
{
6870
}
6971

@@ -187,7 +189,8 @@ class SwiftABIClassifier
187189
PlatformClassifier m_classifier;
188190

189191
public:
190-
SwiftABIClassifier(const ClassifierInfo& info) : m_classifier(info)
192+
SwiftABIClassifier(const ClassifierInfo& info)
193+
: m_classifier(info)
191194
{
192195
}
193196

src/coreclr/jit/alloc.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ size_t ArenaAllocator::getDefaultPageSize()
4242
// ArenaAllocator::ArenaAllocator:
4343
// Default-constructs an arena allocator.
4444
ArenaAllocator::ArenaAllocator()
45-
: m_firstPage(nullptr), m_lastPage(nullptr), m_nextFreeByte(nullptr), m_lastFreeByte(nullptr)
45+
: m_firstPage(nullptr)
46+
, m_lastPage(nullptr)
47+
, m_nextFreeByte(nullptr)
48+
, m_lastFreeByte(nullptr)
4649
{
4750
#if MEASURE_MEM_ALLOC
4851
memset(&m_stats, 0, sizeof(m_stats));

src/coreclr/jit/alloc.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ enum CompMemKind
2222
class ArenaAllocator
2323
{
2424
private:
25-
ArenaAllocator(const ArenaAllocator& other) = delete;
25+
ArenaAllocator(const ArenaAllocator& other) = delete;
2626
ArenaAllocator& operator=(const ArenaAllocator& other) = delete;
27-
ArenaAllocator& operator=(ArenaAllocator&& other) = delete;
27+
ArenaAllocator& operator=(ArenaAllocator&& other) = delete;
2828

2929
struct PageDescriptor
3030
{
@@ -52,7 +52,7 @@ class ArenaAllocator
5252
void* allocateNewPage(size_t size);
5353

5454
static void* allocateHostMemory(size_t size, size_t* pActualSize);
55-
static void freeHostMemory(void* block, size_t size);
55+
static void freeHostMemory(void* block, size_t size);
5656

5757
#if MEASURE_MEM_ALLOC
5858
struct MemStats
@@ -125,8 +125,8 @@ class ArenaAllocator
125125

126126
public:
127127
MemStatsAllocator* getMemStatsAllocator(CompMemKind kind);
128-
void finishMemStats();
129-
void dumpMemStats(FILE* file);
128+
void finishMemStats();
129+
void dumpMemStats(FILE* file);
130130

131131
static void dumpMaxMemStats(FILE* file);
132132
static void dumpAggregateMemStats(FILE* file);
@@ -276,7 +276,8 @@ class CompIAllocator : public IAllocator
276276
char m_zeroLenAllocTarg;
277277

278278
public:
279-
CompIAllocator(CompAllocator alloc) : m_alloc(alloc)
279+
CompIAllocator(CompAllocator alloc)
280+
: m_alloc(alloc)
280281
{
281282
}
282283

src/coreclr/jit/arraystack.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ class ArrayStack
1010
static const int builtinSize = 8;
1111

1212
public:
13-
explicit ArrayStack(CompAllocator alloc, int initialCapacity = builtinSize) : m_alloc(alloc)
13+
explicit ArrayStack(CompAllocator alloc, int initialCapacity = builtinSize)
14+
: m_alloc(alloc)
1415
{
1516
if (initialCapacity > builtinSize)
1617
{

0 commit comments

Comments
 (0)