Skip to content

Commit 866147e

Browse files
authored
Merge branch 'main' into cfg_analyzer_noreturn
2 parents e397c18 + a9dacb1 commit 866147e

File tree

679 files changed

+34313
-5833
lines changed

Some content is hidden

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

679 files changed

+34313
-5833
lines changed

.ci/compute_projects_test.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,34 @@ def test_ci(self):
284284
"check-cxx check-cxxabi check-unwind",
285285
)
286286

287+
def test_windows_ci(self):
288+
env_variables = compute_projects.get_env_variables(
289+
[".ci/compute_projects.py"], "Windows"
290+
)
291+
self.assertEqual(
292+
env_variables["projects_to_build"],
293+
"clang;clang-tools-extra;libclc;lld;llvm;mlir;polly",
294+
)
295+
self.assertEqual(
296+
env_variables["project_check_targets"],
297+
"check-clang check-clang-cir check-clang-tools check-lld check-llvm check-mlir check-polly",
298+
)
299+
self.assertEqual(
300+
env_variables["runtimes_to_build"],
301+
"libcxx;libcxxabi;libunwind",
302+
)
303+
self.assertEqual(
304+
env_variables["runtimes_check_targets"],
305+
"",
306+
)
307+
# TODO(boomanaiden154): We should not be emitting these on Windows.
308+
# It does not currently impact anything because we do not build the
309+
# runtimes on Windows though.
310+
self.assertEqual(
311+
env_variables["runtimes_check_targets_needs_reconfig"],
312+
"check-cxx check-cxxabi check-unwind",
313+
)
314+
287315
def test_lldb(self):
288316
env_variables = compute_projects.get_env_variables(
289317
["lldb/CMakeLists.txt"], "Linux"

.ci/monolithic-linux.sh

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,25 @@ function at-exit {
3838
# If building fails there will be no results files.
3939
shopt -s nullglob
4040

41-
python3 "${MONOREPO_ROOT}"/.ci/generate_test_report_github.py ":penguin: Linux x64 Test Results" \
42-
$retcode "${BUILD_DIR}"/test-results.*.xml >> $GITHUB_STEP_SUMMARY
41+
if [[ "$GITHUB_STEP_SUMMARY" != "" ]]; then
42+
python3 "${MONOREPO_ROOT}"/.ci/generate_test_report_github.py ":penguin: Linux x64 Test Results" \
43+
$retcode "${BUILD_DIR}"/test-results.*.xml >> $GITHUB_STEP_SUMMARY
44+
fi
4345
}
4446
trap at-exit EXIT
4547

48+
function start-group {
49+
groupname=$1
50+
if [[ "$GITHUB_ACTIONS" != "" ]]; then
51+
echo "::endgroup"
52+
echo "::group::$groupname"
53+
elif [[ "$POSTCOMMIT_CI" != "" ]]; then
54+
echo "@@@$STEP@@@"
55+
else
56+
echo "Starting $groupname"
57+
fi
58+
}
59+
4660
projects="${1}"
4761
targets="${2}"
4862
runtimes="${3}"
@@ -52,7 +66,7 @@ enable_cir="${6}"
5266

5367
lit_args="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml --use-unique-output-file-name --timeout=1200 --time-tests"
5468

55-
echo "::group::cmake"
69+
start-group "CMake"
5670
export PIP_BREAK_SYSTEM_PACKAGES=1
5771
pip install -q -r "${MONOREPO_ROOT}"/.ci/all_requirements.txt
5872

@@ -83,49 +97,39 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
8397
-D LLDB_ENFORCE_STRICT_TEST_REQUIREMENTS=ON \
8498
-D CMAKE_INSTALL_PREFIX="${INSTALL_DIR}"
8599

86-
echo "::endgroup::"
87-
echo "::group::ninja"
100+
start-group "ninja"
88101

89102
# Targets are not escaped as they are passed as separate arguments.
90103
ninja -C "${BUILD_DIR}" -k 0 ${targets}
91104

92-
echo "::endgroup::"
93-
94105
if [[ "${runtime_targets}" != "" ]]; then
95-
echo "::group::ninja runtimes"
106+
start-group "ninja Runtimes"
96107

97108
ninja -C "${BUILD_DIR}" ${runtime_targets}
98-
99-
echo "::endgroup::"
100109
fi
101110

102111
# Compiling runtimes with just-built Clang and running their tests
103112
# as an additional testing for Clang.
104113
if [[ "${runtime_targets_needs_reconfig}" != "" ]]; then
105-
echo "::group::cmake runtimes C++26"
114+
start-group "CMake Runtimes C++26"
106115

107116
cmake \
108117
-D LIBCXX_TEST_PARAMS="std=c++26" \
109118
-D LIBCXXABI_TEST_PARAMS="std=c++26" \
110119
"${BUILD_DIR}"
111120

112-
echo "::endgroup::"
113-
echo "::group::ninja runtimes C++26"
121+
start-group "ninja Runtimes C++26"
114122

115123
ninja -C "${BUILD_DIR}" ${runtime_targets_needs_reconfig}
116124

117-
echo "::endgroup::"
118-
echo "::group::cmake runtimes clang modules"
125+
start-group "CMake Runtimes Clang Modules"
119126

120127
cmake \
121128
-D LIBCXX_TEST_PARAMS="enable_modules=clang" \
122129
-D LIBCXXABI_TEST_PARAMS="enable_modules=clang" \
123130
"${BUILD_DIR}"
124131

125-
echo "::endgroup::"
126-
echo "::group::ninja runtimes clang modules"
132+
start-group "ninja Runtimes Clang Modules"
127133

128134
ninja -C "${BUILD_DIR}" ${runtime_targets_needs_reconfig}
129-
130-
echo "::endgroup::"
131135
fi

.ci/monolithic-windows.sh

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,30 @@ function at-exit {
3232

3333
# If building fails there will be no results files.
3434
shopt -s nullglob
35-
36-
python "${MONOREPO_ROOT}"/.ci/generate_test_report_github.py ":window: Windows x64 Test Results" \
37-
$retcode "${BUILD_DIR}"/test-results.*.xml >> $GITHUB_STEP_SUMMARY
35+
36+
if [[ "$GITHUB_STEP_SUMMARY" != "" ]]; then
37+
python "${MONOREPO_ROOT}"/.ci/generate_test_report_github.py ":window: Windows x64 Test Results" \
38+
$retcode "${BUILD_DIR}"/test-results.*.xml >> $GITHUB_STEP_SUMMARY
39+
fi
3840
}
3941
trap at-exit EXIT
4042

43+
function start-group {
44+
groupname=$1
45+
if [[ "$GITHUB_ACTIONS" != "" ]]; then
46+
echo "::endgroup"
47+
echo "::group::$groupname"
48+
elif [[ "$POSTCOMMIT_CI" != "" ]]; then
49+
echo "@@@$STEP@@@"
50+
else
51+
echo "Starting $groupname"
52+
fi
53+
}
54+
4155
projects="${1}"
4256
targets="${2}"
4357

44-
echo "::group::cmake"
58+
start-group "CMake"
4559
pip install -q -r "${MONOREPO_ROOT}"/.ci/all_requirements.txt
4660

4761
export CC=cl
@@ -71,10 +85,7 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
7185
-D CMAKE_MODULE_LINKER_FLAGS="/MANIFEST:NO" \
7286
-D CMAKE_SHARED_LINKER_FLAGS="/MANIFEST:NO"
7387

74-
echo "::endgroup::"
75-
echo "::group::ninja"
88+
start-group "ninja"
7689

7790
# Targets are not escaped as they are passed as separate arguments.
7891
ninja -C "${BUILD_DIR}" -k 0 ${targets}
79-
80-
echo "::endgroup"

.github/workflows/libc-fullbuild-tests.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,36 +20,30 @@ jobs:
2020
include:
2121
- os: ubuntu-24.04
2222
build_type: Debug
23-
ccache-variant: sccache
2423
c_compiler: clang-22
2524
cpp_compiler: clang++-22
2625
target: x86_64-unknown-linux-llvm
2726
include_scudo: ON
2827
- os: ubuntu-24.04
2928
build_type: Release
30-
ccache-variant: sccache
3129
c_compiler: clang-22
3230
cpp_compiler: clang++-22
3331
target: x86_64-unknown-linux-llvm
3432
include_scudo: ON
3533
- os: ubuntu-24.04
3634
build_type: MinSizeRel
37-
ccache-variant: sccache
3835
c_compiler: clang-22
3936
cpp_compiler: clang++-22
4037
target: x86_64-unknown-linux-llvm
4138
include_scudo: ON
42-
# TODO: remove ccache logic when https://github.com/hendrikmuhs/ccache-action/issues/279 is resolved.
4339
- os: ubuntu-24.04-arm
4440
build_type: Debug
45-
ccache-variant: ccache
4641
c_compiler: clang-22
4742
cpp_compiler: clang++-22
4843
target: aarch64-unknown-linux-llvm
4944
include_scudo: ON
5045
- os: ubuntu-24.04
5146
build_type: Debug
52-
ccache-variant: ccache
5347
c_compiler: clang-22
5448
cpp_compiler: clang++-22
5549
target: x86_64-unknown-uefi-llvm
@@ -71,7 +65,7 @@ jobs:
7165
with:
7266
max-size: 1G
7367
key: libc_fullbuild_${{ matrix.c_compiler }}
74-
variant: ${{ matrix.ccache-variant }}
68+
variant: sccache
7569

7670
# Notice:
7771
# - MPFR is required by some of the mathlib tests.
@@ -112,8 +106,8 @@ jobs:
112106
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} \
113107
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }} \
114108
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
115-
-DCMAKE_C_COMPILER_LAUNCHER=${{ matrix.ccache-variant }} \
116-
-DCMAKE_CXX_COMPILER_LAUNCHER=${{ matrix.ccache-variant }} \
109+
-DCMAKE_C_COMPILER_LAUNCHER=sccache \
110+
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache \
117111
-DCMAKE_INSTALL_PREFIX=${{ steps.strings.outputs.build-install-dir }} \
118112
-DLLVM_RUNTIME_TARGETS=${{ matrix.target }} \
119113
-DLLVM_ENABLE_RUNTIMES="$RUNTIMES" \

.github/workflows/libc-overlay-tests.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,28 +20,22 @@ jobs:
2020
include:
2121
# TODO: add linux gcc when it is fixed
2222
- os: ubuntu-24.04
23-
ccache-variant: sccache
2423
compiler:
2524
c_compiler: clang
2625
cpp_compiler: clang++
27-
# TODO: remove ccache logic when https://github.com/hendrikmuhs/ccache-action/issues/279 is resolved.
2826
- os: ubuntu-24.04-arm
29-
ccache-variant: ccache
3027
compiler:
3128
c_compiler: clang
3229
cpp_compiler: clang++
3330
- os: windows-2022
34-
ccache-variant: sccache
3531
compiler:
3632
c_compiler: clang-cl
3733
cpp_compiler: clang-cl
3834
- os: windows-2025
39-
ccache-variant: sccache
4035
compiler:
4136
c_compiler: clang-cl
4237
cpp_compiler: clang-cl
4338
- os: macos-14
44-
ccache-variant: sccache
4539
compiler:
4640
c_compiler: clang
4741
cpp_compiler: clang++
@@ -61,7 +55,7 @@ jobs:
6155
with:
6256
max-size: 1G
6357
key: libc_overlay_build_${{ matrix.os }}_${{ matrix.compiler.c_compiler }}
64-
variant: ${{ matrix.ccache-variant }}
58+
variant: sccache
6559

6660
# MPFR is required by some of the mathlib tests.
6761
- name: Prepare dependencies (Ubuntu)
@@ -97,8 +91,8 @@ jobs:
9791
-DCMAKE_CXX_COMPILER=${{ matrix.compiler.cpp_compiler }}
9892
-DCMAKE_C_COMPILER=${{ matrix.compiler.c_compiler }}
9993
-DCMAKE_BUILD_TYPE=Debug
100-
-DCMAKE_C_COMPILER_LAUNCHER=${{ matrix.ccache-variant }}
101-
-DCMAKE_CXX_COMPILER_LAUNCHER=${{ matrix.ccache-variant }}
94+
-DCMAKE_C_COMPILER_LAUNCHER=sccache
95+
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache
10296
-DCMAKE_POLICY_DEFAULT_CMP0141=NEW
10397
-DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded
10498
-DLLVM_ENABLE_RUNTIMES=libc

.github/workflows/libcxx-build-and-test.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,11 +260,11 @@ jobs:
260260
- name: Install a current LLVM
261261
if: ${{ matrix.mingw != true }}
262262
run: |
263-
choco install -y llvm --version=19.1.7 --allow-downgrade
263+
choco install -y llvm --version=20.1.8 --allow-downgrade
264264
- name: Install llvm-mingw
265265
if: ${{ matrix.mingw == true }}
266266
run: |
267-
curl -LO https://github.com/mstorsjo/llvm-mingw/releases/download/20250114/llvm-mingw-20250114-ucrt-x86_64.zip
267+
curl -LO https://github.com/mstorsjo/llvm-mingw/releases/download/20250709/llvm-mingw-20250709-ucrt-x86_64.zip
268268
powershell Expand-Archive llvm-mingw*.zip -DestinationPath .
269269
del llvm-mingw*.zip
270270
mv llvm-mingw* c:\llvm-mingw

clang-tools-extra/clang-tidy/performance/UnnecessaryCopyInitialization.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -349,23 +349,25 @@ void UnnecessaryCopyInitialization::diagnoseCopyFromMethodReturn(
349349
const CheckContext &Ctx) {
350350
auto Diagnostic =
351351
diag(Ctx.Var.getLocation(),
352-
"the %select{|const qualified }0variable %1 is "
352+
"the %select{|const qualified }0variable %1 of type %2 is "
353353
"copy-constructed "
354354
"from a const reference%select{%select{ but is only used as const "
355-
"reference|}0| but is never used}2; consider "
356-
"%select{making it a const reference|removing the statement}2")
357-
<< Ctx.Var.getType().isConstQualified() << &Ctx.Var << Ctx.IsVarUnused;
355+
"reference|}0| but is never used}3; consider "
356+
"%select{making it a const reference|removing the statement}3")
357+
<< Ctx.Var.getType().isConstQualified() << &Ctx.Var << Ctx.Var.getType()
358+
<< Ctx.IsVarUnused;
358359
maybeIssueFixes(Ctx, Diagnostic);
359360
}
360361

361362
void UnnecessaryCopyInitialization::diagnoseCopyFromLocalVar(
362363
const CheckContext &Ctx, const VarDecl &OldVar) {
363364
auto Diagnostic =
364365
diag(Ctx.Var.getLocation(),
365-
"local copy %1 of the variable %0 is never modified%select{"
366-
"| and never used}2; consider %select{avoiding the copy|removing "
367-
"the statement}2")
368-
<< &OldVar << &Ctx.Var << Ctx.IsVarUnused;
366+
"local copy %0 of the variable %1 of type %2 is never "
367+
"modified%select{"
368+
"| and never used}3; consider %select{avoiding the copy|removing "
369+
"the statement}3")
370+
<< &Ctx.Var << &OldVar << Ctx.Var.getType() << Ctx.IsVarUnused;
369371
maybeIssueFixes(Ctx, Diagnostic);
370372
}
371373

clang-tools-extra/clang-tidy/performance/UnnecessaryValueParamCheck.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,12 @@ void UnnecessaryValueParamCheck::handleConstRefFix(const FunctionDecl &Function,
143143

144144
auto Diag =
145145
diag(Param.getLocation(),
146-
"the %select{|const qualified }0parameter %1 is copied for each "
146+
"the %select{|const qualified }0parameter %1 of type %2 is copied "
147+
"for each "
147148
"invocation%select{ but only used as a const reference|}0; consider "
148149
"making it a %select{const |}0reference")
149-
<< IsConstQualified << paramNameOrIndex(Param.getName(), Index);
150+
<< IsConstQualified << paramNameOrIndex(Param.getName(), Index)
151+
<< Param.getType();
150152
// Do not propose fixes when:
151153
// 1. the ParmVarDecl is in a macro, since we cannot place them correctly
152154
// 2. the function is virtual as it might break overrides
@@ -173,10 +175,11 @@ void UnnecessaryValueParamCheck::handleConstRefFix(const FunctionDecl &Function,
173175
void UnnecessaryValueParamCheck::handleMoveFix(const ParmVarDecl &Param,
174176
const DeclRefExpr &CopyArgument,
175177
ASTContext &Context) {
176-
auto Diag = diag(CopyArgument.getBeginLoc(),
177-
"parameter %0 is passed by value and only copied once; "
178-
"consider moving it to avoid unnecessary copies")
179-
<< &Param;
178+
auto Diag =
179+
diag(CopyArgument.getBeginLoc(),
180+
"parameter %0 of type %1 is passed by value and only copied once; "
181+
"consider moving it to avoid unnecessary copies")
182+
<< &Param << Param.getType();
180183
// Do not propose fixes in macros since we cannot place them correctly.
181184
if (CopyArgument.getBeginLoc().isMacroID())
182185
return;

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,14 @@ Changes in existing checks
170170
when the format string is converted to a different type by an implicit
171171
constructor call.
172172

173+
- Improved :doc:`performance-unnecessary-copy-initialization
174+
<clang-tidy/checks/performance/unnecessary-copy-initialization>` by printing
175+
the type of the diagnosed variable.
176+
177+
- Improved :doc:`performance-unnecessary-value-param
178+
<clang-tidy/checks/performance/unnecessary-value-param>` by printing
179+
the type of the diagnosed variable.
180+
173181
- Improved :doc:`portability-template-virtual-member-function
174182
<clang-tidy/checks/portability/template-virtual-member-function>` check to
175183
avoid false positives on pure virtual member functions.

0 commit comments

Comments
 (0)