Skip to content

Commit 129b7e4

Browse files
authored
Merge branch 'main' into mca-instruction-customizer
2 parents 9e276b6 + 3f6cd76 commit 129b7e4

File tree

1,297 files changed

+42999
-23788
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,297 files changed

+42999
-23788
lines changed

.github/CODEOWNERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,9 @@
132132
/mlir/**/Transforms/Mem2Reg.* @moxinilian
133133
/mlir/**/Transforms/SROA.* @moxinilian
134134

135+
# MLIR IRDL-related
136+
/mlir/**/*IRDL* @moxinilian
137+
135138
# BOLT
136139
/bolt/ @aaupov @maksfb @rafaelauler @ayermolo @yota9 @paschalis-mpeis @yozhu
137140

.github/workflows/gha-codeql.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ on:
77
pull_request:
88
branches:
99
- main
10+
paths:
11+
- '.github/**'
1012
schedule:
1113
- cron: '30 0 * * *'
1214

.github/workflows/libclang-abi-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,10 @@ jobs:
113113
./configure
114114
sudo make install
115115
- name: Download source code
116-
uses: llvm/actions/get-llvm-project-src@main
116+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
117117
with:
118118
ref: ${{ matrix.ref }}
119-
repo: ${{ matrix.repo }}
119+
repository: ${{ matrix.repo }}
120120
- name: Configure
121121
run: |
122122
mkdir install

.github/workflows/libcxx-run-benchmarks.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,14 @@ jobs:
3333
3434
runs-on: llvm-premerge-libcxx-next-runners # TODO: This should run on a dedicated set of machines
3535
steps:
36-
- uses: actions/setup-python@v6
36+
- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
3737
with:
3838
python-version: '3.10'
3939

4040
- name: Extract information from the PR
4141
id: vars
42+
env:
43+
COMMENT_BODY: ${{ github.event.comment.body }}
4244
run: |
4345
python3 -m venv .venv
4446
source .venv/bin/activate
@@ -51,7 +53,7 @@ jobs:
5153
print(f"pr_base={pr.base.sha}")
5254
print(f"pr_head={pr.head.sha}")
5355
EOF
54-
BENCHMARKS=$(echo "${{ github.event.comment.body }}" | sed -nE 's/\/libcxx-bot benchmark (.+)/\1/p')
56+
BENCHMARKS=$(echo "$COMMENT_BODY" | sed -nE 's/\/libcxx-bot benchmark (.+)/\1/p')
5557
echo "benchmarks=${BENCHMARKS}" >> ${GITHUB_OUTPUT}
5658
5759
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

.github/workflows/llvm-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,10 @@ jobs:
101101
./configure
102102
sudo make install
103103
- name: Download source code
104-
uses: llvm/actions/get-llvm-project-src@main
104+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
105105
with:
106106
ref: ${{ matrix.ref }}
107-
repo: ${{ matrix.repo }}
107+
repository: ${{ matrix.repo }}
108108
- name: Configure
109109
run: |
110110
mkdir install

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-include-fixer/IncludeFixer.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,7 @@ bool IncludeFixerActionFactory::runInvocation(
9494

9595
// Create the compiler's actual diagnostics engine. We want to drop all
9696
// diagnostics here.
97-
Compiler.createDiagnostics(Files->getVirtualFileSystem(),
98-
new clang::IgnoringDiagConsumer,
97+
Compiler.createDiagnostics(new clang::IgnoringDiagConsumer,
9998
/*ShouldOwnClient=*/true);
10099
Compiler.createSourceManager(*Files);
101100

clang-tools-extra/clang-tidy/.clang-tidy

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ Checks: >
55
-bugprone-branch-clone,
66
-bugprone-easily-swappable-parameters,
77
-bugprone-narrowing-conversions,
8-
-bugprone-suspicious-stringview-data-usage,
98
-bugprone-unchecked-optional-access,
109
-bugprone-unused-return-value,
1110
modernize-*,

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: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ LLVM_INSTANTIATE_REGISTRY(clang::tidy::ClangTidyModuleRegistry)
5353

5454
namespace clang::tidy {
5555

56+
namespace custom {
57+
extern void registerCustomChecks(const ClangTidyOptions &O,
58+
ClangTidyCheckFactories &Factories);
59+
} // namespace custom
60+
5661
namespace {
5762
#if CLANG_TIDY_ENABLE_STATIC_ANALYZER
5863
#define ANALYZER_CHECK_NAME_PREFIX "clang-analyzer-"
@@ -342,6 +347,10 @@ ClangTidyASTConsumerFactory::ClangTidyASTConsumerFactory(
342347
IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem> OverlayFS)
343348
: Context(Context), OverlayFS(std::move(OverlayFS)),
344349
CheckFactories(new ClangTidyCheckFactories) {
350+
#if CLANG_TIDY_ENABLE_QUERY_BASED_CUSTOM_CHECKS
351+
if (Context.canExperimentalCustomChecks())
352+
custom::registerCustomChecks(Context.getOptions(), *CheckFactories);
353+
#endif
345354
for (ClangTidyModuleRegistry::entry E : ClangTidyModuleRegistry::entries()) {
346355
std::unique_ptr<ClangTidyModule> Module = E.instantiate();
347356
Module->addCheckFactories(*CheckFactories);
@@ -411,7 +420,10 @@ ClangTidyASTConsumerFactory::createASTConsumer(
411420
.getCurrentWorkingDirectory();
412421
if (WorkingDir)
413422
Context.setCurrentBuildDirectory(WorkingDir.get());
414-
423+
#if CLANG_TIDY_ENABLE_QUERY_BASED_CUSTOM_CHECKS
424+
if (Context.canExperimentalCustomChecks())
425+
custom::registerCustomChecks(Context.getOptions(), *CheckFactories);
426+
#endif
415427
std::vector<std::unique_ptr<ClangTidyCheck>> Checks =
416428
CheckFactories->createChecksForLanguage(&Context);
417429

@@ -497,13 +509,13 @@ ClangTidyOptions::OptionMap ClangTidyASTConsumerFactory::getCheckOptions() {
497509
return Options;
498510
}
499511

500-
std::vector<std::string>
501-
getCheckNames(const ClangTidyOptions &Options,
502-
bool AllowEnablingAnalyzerAlphaCheckers) {
512+
std::vector<std::string> getCheckNames(const ClangTidyOptions &Options,
513+
bool AllowEnablingAnalyzerAlphaCheckers,
514+
bool ExperimentalCustomChecks) {
503515
clang::tidy::ClangTidyContext Context(
504516
std::make_unique<DefaultOptionsProvider>(ClangTidyGlobalOptions(),
505517
Options),
506-
AllowEnablingAnalyzerAlphaCheckers);
518+
AllowEnablingAnalyzerAlphaCheckers, false, ExperimentalCustomChecks);
507519
ClangTidyASTConsumerFactory Factory(Context);
508520
return Factory.getCheckNames();
509521
}
@@ -524,11 +536,12 @@ void filterCheckOptions(ClangTidyOptions &Options,
524536

525537
ClangTidyOptions::OptionMap
526538
getCheckOptions(const ClangTidyOptions &Options,
527-
bool AllowEnablingAnalyzerAlphaCheckers) {
539+
bool AllowEnablingAnalyzerAlphaCheckers,
540+
bool ExperimentalCustomChecks) {
528541
clang::tidy::ClangTidyContext Context(
529542
std::make_unique<DefaultOptionsProvider>(ClangTidyGlobalOptions(),
530543
Options),
531-
AllowEnablingAnalyzerAlphaCheckers);
544+
AllowEnablingAnalyzerAlphaCheckers, false, ExperimentalCustomChecks);
532545
ClangTidyDiagnosticConsumer DiagConsumer(Context);
533546
auto DiagOpts = std::make_unique<DiagnosticOptions>();
534547
DiagnosticsEngine DE(llvm::makeIntrusiveRefCnt<DiagnosticIDs>(), *DiagOpts,
@@ -665,15 +678,19 @@ void exportReplacements(const llvm::StringRef MainFilePath,
665678
YAML << TUD;
666679
}
667680

668-
ChecksAndOptions
669-
getAllChecksAndOptions(bool AllowEnablingAnalyzerAlphaCheckers) {
681+
ChecksAndOptions getAllChecksAndOptions(bool AllowEnablingAnalyzerAlphaCheckers,
682+
bool ExperimentalCustomChecks) {
670683
ChecksAndOptions Result;
671684
ClangTidyOptions Opts;
672685
Opts.Checks = "*";
673686
clang::tidy::ClangTidyContext Context(
674687
std::make_unique<DefaultOptionsProvider>(ClangTidyGlobalOptions(), Opts),
675-
AllowEnablingAnalyzerAlphaCheckers);
688+
AllowEnablingAnalyzerAlphaCheckers, false, ExperimentalCustomChecks);
676689
ClangTidyCheckFactories Factories;
690+
#if CLANG_TIDY_ENABLE_QUERY_BASED_CUSTOM_CHECKS
691+
if (ExperimentalCustomChecks)
692+
custom::registerCustomChecks(Context.getOptions(), Factories);
693+
#endif
677694
for (const ClangTidyModuleRegistry::entry &Module :
678695
ClangTidyModuleRegistry::entries()) {
679696
Module.instantiate()->addCheckFactories(Factories);

0 commit comments

Comments
 (0)