Skip to content

Commit 367ac8c

Browse files
committed
Merge branch 'main' into obj2yaml/root-signature-1.2
2 parents d72adfe + 87e1da3 commit 367ac8c

File tree

1,635 files changed

+50559
-18311
lines changed

Some content is hidden

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

1,635 files changed

+50559
-18311
lines changed

.ci/all_requirements.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,9 @@ ml-dtypes==0.5.1 ; python_version < "3.13" \
194194
--hash=sha256:d13755f8e8445b3870114e5b6240facaa7cb0c3361e54beba3e07fa912a6e12b \
195195
--hash=sha256:fd918d4e6a4e0c110e2e05be7a7814d10dc1b95872accbf6512b80a109b71ae1
196196
# via -r mlir/python/requirements.txt
197-
nanobind==2.7.0 \
198-
--hash=sha256:73b12d0e751d140d6c1bf4b215e18818a8debfdb374f08dc3776ad208d808e74 \
199-
--hash=sha256:f9f1b160580c50dcf37b6495a0fd5ec61dc0d95dae5f8004f87dd9ad7eb46b34
197+
nanobind==2.9.2 \
198+
--hash=sha256:c37957ffd5eac7eda349cff3622ecd32e5ee1244ecc912c99b5bc8188bafd16e \
199+
--hash=sha256:e7608472de99d375759814cab3e2c94aba3f9ec80e62cfef8ced495ca5c27d6e
200200
# via -r mlir/python/requirements.txt
201201
numpy==2.0.2 \
202202
--hash=sha256:0123ffdaa88fa4ab64835dcbde75dcdf89c453c922f18dced6e27c90d1d0ec5a \
@@ -383,6 +383,10 @@ swig==4.3.1 \
383383
--hash=sha256:efec16327029f682f649a26da726bb0305be8800bd0f1fa3e81bf0769cf5b476 \
384384
--hash=sha256:fc496c0d600cf1bb2d91e28d3d6eae9c4301e5ea7a0dec5a4281b5efed4245a8
385385
# via -r lldb/test/requirements.txt
386+
typing-extensions==4.15.0 \
387+
--hash=sha256:0cea48d173cc12fa28ecabc3b837ea3cf6f38c6d1136f85cbaaf598984861466 \
388+
--hash=sha256:f0fa19c6845758ab08074a0cfa8b7aecb71c999ca73d62883bc25cc018c4e548
389+
# via -r mlir/python/requirements.txt
386390
urllib3==2.5.0 \
387391
--hash=sha256:3fc47733c7e419d4bc3f6b3dc2b4f890bb743906a30d56ba4a5bfa4bbff92760 \
388392
--hash=sha256:e6b01673c0fa6a13e374b50871808eb3bf7046c4b125b216f6bf1cc604cff0dc

.ci/monolithic-linux.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ enable_cir="${6}"
3232
lit_args="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml --use-unique-output-file-name --timeout=1200 --time-tests --succinct"
3333

3434
start-group "CMake"
35-
export PIP_BREAK_SYSTEM_PACKAGES=1
36-
pip install -q -r "${MONOREPO_ROOT}"/.ci/all_requirements.txt
3735

3836
# Set the system llvm-symbolizer as preferred.
3937
export LLVM_SYMBOLIZER_PATH=`which llvm-symbolizer`

.ci/utils.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,10 @@ function start-group {
5252
echo "Starting $groupname"
5353
fi
5454
}
55+
56+
export PIP_BREAK_SYSTEM_PACKAGES=1
57+
pip install -q -r "${MONOREPO_ROOT}"/.ci/all_requirements.txt
58+
59+
if [[ "$GITHUB_ACTIONS" != "" ]]; then
60+
python .ci/cache_lit_timing_files.py download
61+
fi

.github/CODEOWNERS

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@
5959
/mlir/**/BufferizableOpInterfaceImpl.* @matthias-springer
6060
/mlir/Dialect/*/Transforms/Bufferize.cpp @matthias-springer
6161

62+
# DLTI Dialect in MLIR
63+
/mlir/**/Dialect/DLTI @rolfmorel
64+
/mlir/**/DataLayoutInterfaces.* @rolfmorel
65+
6266
# Linalg Dialect in MLIR.
6367
/mlir/include/mlir/Dialect/Linalg @dcaballe @nicolasvasilache @rengolin
6468
/mlir/lib/Dialect/Linalg @dcaballe @nicolasvasilache @rengolin
@@ -96,9 +100,9 @@
96100
/mlir/lib/Dialect/Tensor/Transforms/* @hanhanW @nicolasvasilache
97101

98102
# Transform Dialect in MLIR.
99-
/mlir/include/mlir/Dialect/Transform/* @ftynse @nicolasvasilache
100-
/mlir/lib/Dialect/Transform/* @ftynse @nicolasvasilache
101-
/mlir/**/*TransformOps* @ftynse @nicolasvasilache
103+
/mlir/include/mlir/Dialect/Transform/* @ftynse @nicolasvasilache @rolfmorel
104+
/mlir/lib/Dialect/Transform/* @ftynse @nicolasvasilache @rolfmorel
105+
/mlir/**/*TransformOps* @ftynse @nicolasvasilache @rolfmorel
102106

103107
# SPIR-V Dialect in MLIR.
104108
/mlir/**/SPIRV/ @antiagainst @kuhar

.github/workflows/issue-write.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
- "Check code formatting"
77
- "Check for private emails used in PRs"
88
- "PR Request Release Note"
9+
- "Code lint"
910
types:
1011
- completed
1112

.github/workflows/pr-code-format.yml

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,6 @@ jobs:
3232
base_sha: 'HEAD~1'
3333
sha: 'HEAD'
3434

35-
# We need to pull the script from the main branch, so that we ensure
36-
# we get the latest version of this script.
37-
- name: Fetch code formatting utils
38-
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
39-
with:
40-
repository: ${{ github.repository }}
41-
ref: ${{ github.base_ref }}
42-
sparse-checkout: |
43-
llvm/utils/git/requirements_formatting.txt
44-
llvm/utils/git/code-format-helper.py
45-
sparse-checkout-cone-mode: false
46-
path: code-format-tools
47-
4835
- name: "Listed files"
4936
env:
5037
CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
@@ -65,10 +52,10 @@ jobs:
6552
with:
6653
python-version: '3.11'
6754
cache: 'pip'
68-
cache-dependency-path: 'code-format-tools/llvm/utils/git/requirements_formatting.txt'
55+
cache-dependency-path: 'llvm/utils/git/requirements_formatting.txt'
6956

7057
- name: Install python dependencies
71-
run: pip install -r code-format-tools/llvm/utils/git/requirements_formatting.txt
58+
run: pip install -r llvm/utils/git/requirements_formatting.txt
7259

7360
- name: Run code formatter
7461
env:
@@ -77,7 +64,7 @@ jobs:
7764
# Create an empty comments file so the pr-write job doesn't fail.
7865
run: |
7966
echo "[]" > comments &&
80-
python ./code-format-tools/llvm/utils/git/code-format-helper.py \
67+
python ./llvm/utils/git/code-format-helper.py \
8168
--write-comment-to-file \
8269
--token ${{ secrets.GITHUB_TOKEN }} \
8370
--issue-number $GITHUB_PR_NUMBER \

.github/workflows/pr-code-lint.yml

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
name: "Code lint"
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
pull_request:
8+
branches:
9+
- main
10+
- 'users/**'
11+
paths:
12+
- 'clang-tools-extra/clang-tidy/**'
13+
- '.github/workflows/pr-code-lint.yml'
14+
15+
jobs:
16+
code_linter:
17+
if: github.repository_owner == 'llvm'
18+
runs-on: ubuntu-24.04
19+
defaults:
20+
run:
21+
shell: bash
22+
container:
23+
image: 'ghcr.io/llvm/ci-ubuntu-24.04:latest'
24+
timeout-minutes: 60
25+
concurrency:
26+
group: ${{ github.workflow }}-${{ github.ref }}
27+
cancel-in-progress: true
28+
steps:
29+
- name: Fetch LLVM sources
30+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
31+
with:
32+
fetch-depth: 2
33+
34+
- name: Get changed files
35+
id: changed-files
36+
uses: step-security/changed-files@3dbe17c78367e7d60f00d78ae6781a35be47b4a1 # v45.0.1
37+
with:
38+
separator: ","
39+
skip_initial_fetch: true
40+
base_sha: 'HEAD~1'
41+
sha: 'HEAD'
42+
43+
- name: Listed files
44+
env:
45+
CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
46+
run: |
47+
echo "Changed files:"
48+
echo "$CHANGED_FILES"
49+
50+
- name: Install clang-tidy
51+
uses: aminya/setup-cpp@17c11551771948abc5752bbf3183482567c7caf0 # v1.1.1
52+
with:
53+
clang-tidy: 20.1.8
54+
55+
- name: Setup Python env
56+
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
57+
with:
58+
python-version: '3.12'
59+
60+
- name: Install Python dependencies
61+
run: python3 -m pip install -r llvm/utils/git/requirements_linting.txt
62+
63+
# TODO: create special mapping for 'codegen' targets, for now build predefined set
64+
# TODO: add entrypoint in 'compute_projects.py' that only adds a project and its direct dependencies
65+
- name: Configure and CodeGen
66+
run: |
67+
git config --global --add safe.directory '*'
68+
69+
. <(git diff --name-only HEAD~1...HEAD | python3 .ci/compute_projects.py)
70+
71+
if [[ "${projects_to_build}" == "" ]]; then
72+
echo "No projects to analyze"
73+
exit 0
74+
fi
75+
76+
cmake -G Ninja \
77+
-B build \
78+
-S llvm \
79+
-DLLVM_ENABLE_ASSERTIONS=OFF \
80+
-DLLVM_ENABLE_PROJECTS="${projects_to_build}" \
81+
-DCMAKE_CXX_COMPILER=clang++ \
82+
-DCMAKE_C_COMPILER=clang \
83+
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
84+
-DLLVM_INCLUDE_TESTS=OFF \
85+
-DCLANG_INCLUDE_TESTS=OFF \
86+
-DCMAKE_BUILD_TYPE=Release
87+
88+
ninja -C build \
89+
clang-tablegen-targets \
90+
genconfusable # for "ConfusableIdentifierCheck.h"
91+
92+
- name: Run code linter
93+
env:
94+
GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }}
95+
CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
96+
run: |
97+
echo "[]" > comments &&
98+
python3 llvm/utils/git/code-lint-helper.py \
99+
--token ${{ secrets.GITHUB_TOKEN }} \
100+
--issue-number $GITHUB_PR_NUMBER \
101+
--start-rev HEAD~1 \
102+
--end-rev HEAD \
103+
--verbose \
104+
--changed-files "$CHANGED_FILES"
105+
106+
- name: Upload results
107+
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 #v4.3.0
108+
if: always()
109+
with:
110+
name: workflow-args
111+
path: |
112+
comments

clang-tools-extra/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ include(GNUInstallDirs)
55

66
option(CLANG_TIDY_ENABLE_STATIC_ANALYZER
77
"Include static analyzer checks in clang-tidy" ON)
8+
option(CLANG_TIDY_ENABLE_QUERY_BASED_CUSTOM_CHECKS
9+
"Enable query-based custom checks in clang-tidy" ON)
810

911
if(CLANG_INCLUDE_TESTS)
1012
umbrella_lit_testsuite_begin(check-clang-tools)

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ add_subdirectory(bugprone)
5858
add_subdirectory(cert)
5959
add_subdirectory(concurrency)
6060
add_subdirectory(cppcoreguidelines)
61+
add_subdirectory(custom)
6162
add_subdirectory(darwin)
6263
add_subdirectory(fuchsia)
6364
add_subdirectory(google)
@@ -101,6 +102,10 @@ set(ALL_CLANG_TIDY_CHECKS
101102
clangTidyReadabilityModule
102103
clangTidyZirconModule
103104
)
105+
106+
if(CLANG_TIDY_ENABLE_QUERY_BASED_CUSTOM_CHECKS)
107+
list(APPEND ALL_CLANG_TIDY_CHECKS clangTidyCustomModule)
108+
endif()
104109
if(CLANG_TIDY_ENABLE_STATIC_ANALYZER)
105110
list(APPEND ALL_CLANG_TIDY_CHECKS clangTidyMPIModule)
106111
endif()

clang-tools-extra/clang-tidy/ClangTidy.cpp

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
/// \file This file implements a clang-tidy tool.
1010
///
1111
/// This tool uses the Clang Tooling infrastructure, see
12-
/// http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html
12+
/// https://clang.llvm.org/docs/HowToSetupToolingForLLVM.html
1313
/// for details on setting it up with LLVM source tree.
1414
///
1515
//===----------------------------------------------------------------------===//
@@ -53,6 +53,13 @@ LLVM_INSTANTIATE_REGISTRY(clang::tidy::ClangTidyModuleRegistry)
5353

5454
namespace clang::tidy {
5555

56+
#if CLANG_TIDY_ENABLE_QUERY_BASED_CUSTOM_CHECKS
57+
namespace custom {
58+
void (*RegisterCustomChecks)(const ClangTidyOptions &O,
59+
ClangTidyCheckFactories &Factories) = nullptr;
60+
} // namespace custom
61+
#endif
62+
5663
namespace {
5764
#if CLANG_TIDY_ENABLE_STATIC_ANALYZER
5865
#define ANALYZER_CHECK_NAME_PREFIX "clang-analyzer-"
@@ -342,6 +349,10 @@ ClangTidyASTConsumerFactory::ClangTidyASTConsumerFactory(
342349
IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem> OverlayFS)
343350
: Context(Context), OverlayFS(std::move(OverlayFS)),
344351
CheckFactories(new ClangTidyCheckFactories) {
352+
#if CLANG_TIDY_ENABLE_QUERY_BASED_CUSTOM_CHECKS
353+
if (Context.canExperimentalCustomChecks() && custom::RegisterCustomChecks)
354+
custom::RegisterCustomChecks(Context.getOptions(), *CheckFactories);
355+
#endif
345356
for (ClangTidyModuleRegistry::entry E : ClangTidyModuleRegistry::entries()) {
346357
std::unique_ptr<ClangTidyModule> Module = E.instantiate();
347358
Module->addCheckFactories(*CheckFactories);
@@ -411,7 +422,10 @@ ClangTidyASTConsumerFactory::createASTConsumer(
411422
.getCurrentWorkingDirectory();
412423
if (WorkingDir)
413424
Context.setCurrentBuildDirectory(WorkingDir.get());
414-
425+
#if CLANG_TIDY_ENABLE_QUERY_BASED_CUSTOM_CHECKS
426+
if (Context.canExperimentalCustomChecks() && custom::RegisterCustomChecks)
427+
custom::RegisterCustomChecks(Context.getOptions(), *CheckFactories);
428+
#endif
415429
std::vector<std::unique_ptr<ClangTidyCheck>> Checks =
416430
CheckFactories->createChecksForLanguage(&Context);
417431

@@ -497,13 +511,13 @@ ClangTidyOptions::OptionMap ClangTidyASTConsumerFactory::getCheckOptions() {
497511
return Options;
498512
}
499513

500-
std::vector<std::string>
501-
getCheckNames(const ClangTidyOptions &Options,
502-
bool AllowEnablingAnalyzerAlphaCheckers) {
514+
std::vector<std::string> getCheckNames(const ClangTidyOptions &Options,
515+
bool AllowEnablingAnalyzerAlphaCheckers,
516+
bool ExperimentalCustomChecks) {
503517
clang::tidy::ClangTidyContext Context(
504518
std::make_unique<DefaultOptionsProvider>(ClangTidyGlobalOptions(),
505519
Options),
506-
AllowEnablingAnalyzerAlphaCheckers);
520+
AllowEnablingAnalyzerAlphaCheckers, false, ExperimentalCustomChecks);
507521
ClangTidyASTConsumerFactory Factory(Context);
508522
return Factory.getCheckNames();
509523
}
@@ -524,11 +538,12 @@ void filterCheckOptions(ClangTidyOptions &Options,
524538

525539
ClangTidyOptions::OptionMap
526540
getCheckOptions(const ClangTidyOptions &Options,
527-
bool AllowEnablingAnalyzerAlphaCheckers) {
541+
bool AllowEnablingAnalyzerAlphaCheckers,
542+
bool ExperimentalCustomChecks) {
528543
clang::tidy::ClangTidyContext Context(
529544
std::make_unique<DefaultOptionsProvider>(ClangTidyGlobalOptions(),
530545
Options),
531-
AllowEnablingAnalyzerAlphaCheckers);
546+
AllowEnablingAnalyzerAlphaCheckers, false, ExperimentalCustomChecks);
532547
ClangTidyDiagnosticConsumer DiagConsumer(Context);
533548
auto DiagOpts = std::make_unique<DiagnosticOptions>();
534549
DiagnosticsEngine DE(llvm::makeIntrusiveRefCnt<DiagnosticIDs>(), *DiagOpts,
@@ -665,15 +680,19 @@ void exportReplacements(const llvm::StringRef MainFilePath,
665680
YAML << TUD;
666681
}
667682

668-
ChecksAndOptions
669-
getAllChecksAndOptions(bool AllowEnablingAnalyzerAlphaCheckers) {
683+
ChecksAndOptions getAllChecksAndOptions(bool AllowEnablingAnalyzerAlphaCheckers,
684+
bool ExperimentalCustomChecks) {
670685
ChecksAndOptions Result;
671686
ClangTidyOptions Opts;
672687
Opts.Checks = "*";
673688
clang::tidy::ClangTidyContext Context(
674689
std::make_unique<DefaultOptionsProvider>(ClangTidyGlobalOptions(), Opts),
675-
AllowEnablingAnalyzerAlphaCheckers);
690+
AllowEnablingAnalyzerAlphaCheckers, false, ExperimentalCustomChecks);
676691
ClangTidyCheckFactories Factories;
692+
#if CLANG_TIDY_ENABLE_QUERY_BASED_CUSTOM_CHECKS
693+
if (ExperimentalCustomChecks && custom::RegisterCustomChecks)
694+
custom::RegisterCustomChecks(Context.getOptions(), Factories);
695+
#endif
677696
for (const ClangTidyModuleRegistry::entry &Module :
678697
ClangTidyModuleRegistry::entries()) {
679698
Module.instantiate()->addCheckFactories(Factories);

0 commit comments

Comments
 (0)