Skip to content

Commit 1fc4a03

Browse files
fix CI
Created using spr 1.3.6
2 parents f752783 + a608b0c commit 1fc4a03

File tree

343 files changed

+9285
-6293
lines changed

Some content is hidden

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

343 files changed

+9285
-6293
lines changed

.ci/compute_projects.py

Lines changed: 42 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,23 @@
144144

145145
RUNTIMES = {"libcxx", "libcxxabi", "libunwind", "compiler-rt", "libc"}
146146

147+
# Meta projects are projects that need explicit handling but do not reside
148+
# in their own top level folder. To add a meta project, the start of the path
149+
# for the metaproject should be mapped to the name of the project below.
150+
# Multiple paths can map to the same metaproject.
151+
META_PROJECTS = {
152+
("clang", "lib", "CIR"): "CIR",
153+
("clang", "test", "CIR"): "CIR",
154+
("clang", "include", "clang", "CIR"): "CIR",
155+
("*", "docs"): "docs",
156+
("llvm", "utils", "gn"): "gn",
157+
(".github", "workflows", "premerge.yaml"): ".ci",
158+
("third-party",): ".ci",
159+
}
160+
161+
# Projects that should not run any tests. These need to be metaprojects.
162+
SKIP_PROJECTS = ["docs", "gn"]
163+
147164

148165
def _add_dependencies(projects: Set[str], runtimes: Set[str]) -> Set[str]:
149166
projects_with_dependents = set(projects)
@@ -236,29 +253,34 @@ def _compute_runtimes_to_build(
236253
return _exclude_projects(runtimes_to_build, platform)
237254

238255

256+
def _path_matches(matcher: tuple[str], file_path: tuple[str]) -> bool:
257+
if len(file_path) < len(matcher):
258+
return False
259+
for match_part, file_part in zip(matcher, file_path):
260+
if match_part == "*" or file_part == "*":
261+
continue
262+
if match_part != file_part:
263+
return False
264+
return True
265+
266+
267+
def _get_modified_projects_for_file(modified_file: str) -> Set[str]:
268+
modified_projects = set()
269+
path_parts = pathlib.Path(modified_file).parts
270+
for meta_project_files in META_PROJECTS.keys():
271+
if _path_matches(meta_project_files, path_parts):
272+
meta_project = META_PROJECTS[meta_project_files]
273+
if meta_project in SKIP_PROJECTS:
274+
return set()
275+
modified_projects.add(meta_project)
276+
modified_projects.add(pathlib.Path(modified_file).parts[0])
277+
return modified_projects
278+
279+
239280
def _get_modified_projects(modified_files: list[str]) -> Set[str]:
240281
modified_projects = set()
241282
for modified_file in modified_files:
242-
path_parts = pathlib.Path(modified_file).parts
243-
# Exclude files in the docs directory. They do not impact an test
244-
# targets and there is a separate workflow used for ensuring the
245-
# documentation builds.
246-
if len(path_parts) > 2 and path_parts[1] == "docs":
247-
continue
248-
# Exclude files for the gn build. We do not test it within premerge
249-
# and changes occur often enough that they otherwise take up
250-
# capacity.
251-
if len(path_parts) > 3 and path_parts[:3] == ("llvm", "utils", "gn"):
252-
continue
253-
# If the file is in the clang/lib/CIR directory, add the CIR project.
254-
if len(path_parts) > 3 and (
255-
path_parts[:3] == ("clang", "lib", "CIR")
256-
or path_parts[:3] == ("clang", "test", "CIR")
257-
or path_parts[:4] == ("clang", "include", "clang", "CIR")
258-
):
259-
modified_projects.add("CIR")
260-
# Fall through to add clang.
261-
modified_projects.add(pathlib.Path(modified_file).parts[0])
283+
modified_projects.update(_get_modified_projects_for_file(modified_file))
262284
return modified_projects
263285

264286

.ci/compute_projects_test.py

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ def test_flang(self):
203203

204204
def test_invalid_subproject(self):
205205
env_variables = compute_projects.get_env_variables(
206-
["third-party/benchmark/CMakeLists.txt"], "Linux"
206+
["llvm-libgcc/CMakeLists.txt"], "Linux"
207207
)
208208
self.assertEqual(env_variables["projects_to_build"], "")
209209
self.assertEqual(env_variables["project_check_targets"], "")
@@ -308,6 +308,66 @@ def test_clang_tools_extra(self):
308308
self.assertEqual(env_variables["runtimes_check_targets"], "check-libc")
309309
self.assertEqual(env_variables["runtimes_check_targets_needs_reconfig"], "")
310310

311+
def test_premerge_workflow(self):
312+
env_variables = compute_projects.get_env_variables(
313+
[".github/workflows/premerge.yaml"], "Linux"
314+
)
315+
self.assertEqual(
316+
env_variables["projects_to_build"],
317+
"bolt;clang;clang-tools-extra;flang;libclc;lld;lldb;llvm;mlir;polly",
318+
)
319+
self.assertEqual(
320+
env_variables["project_check_targets"],
321+
"check-bolt check-clang check-clang-cir check-clang-tools check-flang check-lld check-lldb check-llvm check-mlir check-polly",
322+
)
323+
self.assertEqual(
324+
env_variables["runtimes_to_build"],
325+
"compiler-rt;libc;libcxx;libcxxabi;libunwind",
326+
)
327+
self.assertEqual(
328+
env_variables["runtimes_check_targets"],
329+
"check-compiler-rt check-libc",
330+
)
331+
self.assertEqual(
332+
env_variables["runtimes_check_targets_needs_reconfig"],
333+
"check-cxx check-cxxabi check-unwind",
334+
)
335+
336+
def test_other_github_workflow(self):
337+
env_variables = compute_projects.get_env_variables(
338+
[".github/workflows/docs.yml"], "Linux"
339+
)
340+
self.assertEqual(env_variables["projects_to_build"], "")
341+
self.assertEqual(env_variables["project_check_targets"], "")
342+
self.assertEqual(env_variables["runtimes_to_build"], "")
343+
self.assertEqual(env_variables["runtimes_check_targets"], "")
344+
self.assertEqual(env_variables["runtimes_check_targets_needs_reconfig"], "")
345+
346+
def test_third_party_benchmark(self):
347+
env_variables = compute_projects.get_env_variables(
348+
["third-party/benchmark/CMakeLists.txt"], "Linux"
349+
)
350+
self.assertEqual(
351+
env_variables["projects_to_build"],
352+
"bolt;clang;clang-tools-extra;flang;libclc;lld;lldb;llvm;mlir;polly",
353+
)
354+
self.assertEqual(
355+
env_variables["project_check_targets"],
356+
"check-bolt check-clang check-clang-cir check-clang-tools check-flang check-lld check-lldb check-llvm check-mlir check-polly",
357+
)
358+
self.assertEqual(
359+
env_variables["runtimes_to_build"],
360+
"compiler-rt;libc;libcxx;libcxxabi;libunwind",
361+
)
362+
self.assertEqual(
363+
env_variables["runtimes_check_targets"],
364+
"check-compiler-rt check-libc",
365+
)
366+
self.assertEqual(
367+
env_variables["runtimes_check_targets_needs_reconfig"],
368+
"check-cxx check-cxxabi check-unwind",
369+
)
370+
311371

312372
if __name__ == "__main__":
313373
unittest.main()

.github/workflows/check-ci.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Check CI Scripts
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
push:
8+
paths:
9+
- '.ci/**'
10+
- '.github/workflows/check-ci.yml'
11+
pull_request:
12+
paths:
13+
- '.ci/**'
14+
- '.github/workflows/check-ci.yml'
15+
16+
jobs:
17+
test-python:
18+
name: "Check Python Tests"
19+
runs-on: ubuntu-24.04
20+
if: github.repository == 'llvm/llvm-project'
21+
steps:
22+
- name: Fetch LLVM sources
23+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
24+
with:
25+
sparse-checkout: .ci
26+
- name: Setup Python
27+
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
28+
with:
29+
python-version: 3.13
30+
cache: 'pip'
31+
- name: Install Python Dependencies
32+
run: |
33+
pip3 install -r .ci/all_requirements.txt
34+
pip3 install -r .ci/metrics/requirements.lock.txt
35+
pip3 install pytest==8.4.1
36+
- name: Run Tests
37+
working-directory: .ci
38+
run: pytest

.github/workflows/containers/github-action-ci-windows/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ RUN powershell -Command \
9090
RUN git config --system core.longpaths true & \
9191
git config --global core.autocrlf false
9292
93-
ARG RUNNER_VERSION=2.326.0
93+
ARG RUNNER_VERSION=2.327.0
9494
ENV RUNNER_VERSION=$RUNNER_VERSION
9595
9696
RUN powershell -Command \

.github/workflows/containers/github-action-ci/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ WORKDIR /home/gha
9696

9797
FROM ci-container as ci-container-agent
9898

99-
ENV GITHUB_RUNNER_VERSION=2.326.0
99+
ENV GITHUB_RUNNER_VERSION=2.327.0
100100

101101
RUN mkdir actions-runner && \
102102
cd actions-runner && \

clang-tools-extra/clang-tidy/bugprone/SignedCharMisuseCheck.cpp

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,25 @@ void SignedCharMisuseCheck::registerMatchers(MatchFinder *Finder) {
7474
charCastExpression(true, IntegerType, "signedCastExpression");
7575
const auto UnSignedCharCastExpr =
7676
charCastExpression(false, IntegerType, "unsignedCastExpression");
77+
const bool IsC23 = getLangOpts().C23;
7778

78-
// Catch assignments with signed char -> integer conversion.
79+
// Catch assignments with signed char -> integer conversion. Ignore false
80+
// positives on C23 enums with the fixed underlying type of signed char.
7981
const auto AssignmentOperatorExpr =
8082
expr(binaryOperator(hasOperatorName("="), hasLHS(hasType(IntegerType)),
81-
hasRHS(SignedCharCastExpr)));
83+
hasRHS(SignedCharCastExpr)),
84+
IsC23 ? unless(binaryOperator(
85+
hasLHS(hasType(hasCanonicalType(enumType())))))
86+
: Matcher<Stmt>(anything()));
8287

8388
Finder->addMatcher(AssignmentOperatorExpr, this);
8489

85-
// Catch declarations with signed char -> integer conversion.
86-
const auto Declaration = varDecl(isDefinition(), hasType(IntegerType),
87-
hasInitializer(SignedCharCastExpr));
90+
// Catch declarations with signed char -> integer conversion. Ignore false
91+
// positives on C23 enums with the fixed underlying type of signed char.
92+
const auto Declaration = varDecl(
93+
isDefinition(), hasType(IntegerType), hasInitializer(SignedCharCastExpr),
94+
IsC23 ? unless(hasType(hasCanonicalType(enumType())))
95+
: Matcher<VarDecl>(anything()));
8896

8997
Finder->addMatcher(Declaration, this);
9098

clang-tools-extra/clang-tidy/llvm/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@ add_clang_library(clangTidyLLVMModule STATIC
1111
PreferRegisterOverUnsignedCheck.cpp
1212
PreferStaticOverAnonymousNamespaceCheck.cpp
1313
TwineLocalCheck.cpp
14+
UseNewMLIROpBuilderCheck.cpp
1415

1516
LINK_LIBS
1617
clangTidy
1718
clangTidyReadabilityModule
1819
clangTidyUtils
20+
clangTransformer
1921

2022
DEPENDS
2123
omp_gen

clang-tools-extra/clang-tidy/llvm/LLVMTidyModule.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "PreferRegisterOverUnsignedCheck.h"
1919
#include "PreferStaticOverAnonymousNamespaceCheck.h"
2020
#include "TwineLocalCheck.h"
21+
#include "UseNewMLIROpBuilderCheck.h"
2122

2223
namespace clang::tidy {
2324
namespace llvm_check {
@@ -40,6 +41,8 @@ class LLVMModule : public ClangTidyModule {
4041
CheckFactories.registerCheck<readability::QualifiedAutoCheck>(
4142
"llvm-qualified-auto");
4243
CheckFactories.registerCheck<TwineLocalCheck>("llvm-twine-local");
44+
CheckFactories.registerCheck<UseNewMlirOpBuilderCheck>(
45+
"llvm-use-new-mlir-op-builder");
4346
}
4447

4548
ClangTidyOptions getModuleOptions() override {

0 commit comments

Comments
 (0)