Skip to content

Commit 3fa56c1

Browse files
authored
Merge branch 'main' into buildertidy
2 parents f23c42b + 3a2eb08 commit 3fa56c1

File tree

249 files changed

+4532
-2968
lines changed

Some content is hidden

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

249 files changed

+4532
-2968
lines changed

.ci/compute_projects.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@
150150
"mlir": "check-mlir",
151151
"openmp": "check-openmp",
152152
"polly": "check-polly",
153+
"lit": "check-lit",
153154
}
154155

155156
RUNTIMES = {"libcxx", "libcxxabi", "libunwind", "compiler-rt", "libc", "flang-rt"}
@@ -166,8 +167,12 @@
166167
("llvm", "utils", "gn"): "gn",
167168
(".github", "workflows", "premerge.yaml"): ".ci",
168169
("third-party",): ".ci",
170+
("llvm", "utils", "lit"): "lit",
169171
}
170172

173+
# Projects that should run tests but cannot be explicitly built.
174+
SKIP_BUILD_PROJECTS = ["CIR", "lit"]
175+
171176
# Projects that should not run any tests. These need to be metaprojects.
172177
SKIP_PROJECTS = ["docs", "gn"]
173178

@@ -315,7 +320,9 @@ def get_env_variables(modified_files: list[str], platform: str) -> Set[str]:
315320
# clang build, but it requires an explicit option to enable. We set that
316321
# option here, and remove it from the projects_to_build list.
317322
enable_cir = "ON" if "CIR" in projects_to_build else "OFF"
318-
projects_to_build.discard("CIR")
323+
# Remove any metaprojects from the list of projects to build.
324+
for project in SKIP_BUILD_PROJECTS:
325+
projects_to_build.discard(project)
319326

320327
# We use a semicolon to separate the projects/runtimes as they get passed
321328
# to the CMake invocation and thus we need to use the CMake list separator

.ci/compute_projects_test.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,30 @@ def test_third_party_benchmark(self):
413413
"check-cxx check-cxxabi check-unwind",
414414
)
415415

416+
def test_lit(self):
417+
env_variables = compute_projects.get_env_variables(
418+
["llvm/utils/lit/CMakeLists.txt"], "Linux"
419+
)
420+
self.assertEqual(
421+
env_variables["projects_to_build"],
422+
"bolt;clang;clang-tools-extra;flang;lld;lldb;llvm;mlir;polly",
423+
)
424+
self.assertEqual(
425+
env_variables["project_check_targets"],
426+
"check-bolt check-clang check-clang-tools check-flang check-lit check-lld check-lldb check-llvm check-mlir check-polly",
427+
)
428+
self.assertEqual(
429+
env_variables["runtimes_to_build"], "libcxx;libcxxabi;libunwind"
430+
)
431+
self.assertEqual(
432+
env_variables["runtimes_check_targets"],
433+
"",
434+
)
435+
self.assertEqual(
436+
env_variables["runtimes_check_targets_needs_reconfig"],
437+
"check-cxx check-cxxabi check-unwind",
438+
)
439+
416440

417441
if __name__ == "__main__":
418442
unittest.main()

clang-tools-extra/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ 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)
108

119
if(CLANG_INCLUDE_TESTS)
1210
umbrella_lit_testsuite_begin(check-clang-tools)

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ add_subdirectory(bugprone)
5858
add_subdirectory(cert)
5959
add_subdirectory(concurrency)
6060
add_subdirectory(cppcoreguidelines)
61-
add_subdirectory(custom)
6261
add_subdirectory(darwin)
6362
add_subdirectory(fuchsia)
6463
add_subdirectory(google)
@@ -102,10 +101,6 @@ set(ALL_CLANG_TIDY_CHECKS
102101
clangTidyReadabilityModule
103102
clangTidyZirconModule
104103
)
105-
106-
if(CLANG_TIDY_ENABLE_QUERY_BASED_CUSTOM_CHECKS)
107-
list(APPEND ALL_CLANG_TIDY_CHECKS clangTidyCustomModule)
108-
endif()
109104
if(CLANG_TIDY_ENABLE_STATIC_ANALYZER)
110105
list(APPEND ALL_CLANG_TIDY_CHECKS clangTidyMPIModule)
111106
endif()

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

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,6 @@ 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-
6156
namespace {
6257
#if CLANG_TIDY_ENABLE_STATIC_ANALYZER
6358
#define ANALYZER_CHECK_NAME_PREFIX "clang-analyzer-"
@@ -347,10 +342,6 @@ ClangTidyASTConsumerFactory::ClangTidyASTConsumerFactory(
347342
IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem> OverlayFS)
348343
: Context(Context), OverlayFS(std::move(OverlayFS)),
349344
CheckFactories(new ClangTidyCheckFactories) {
350-
#if CLANG_TIDY_ENABLE_QUERY_BASED_CUSTOM_CHECKS
351-
if (Context.canExperimentalCustomChecks())
352-
custom::registerCustomChecks(Context.getOptions(), *CheckFactories);
353-
#endif
354345
for (ClangTidyModuleRegistry::entry E : ClangTidyModuleRegistry::entries()) {
355346
std::unique_ptr<ClangTidyModule> Module = E.instantiate();
356347
Module->addCheckFactories(*CheckFactories);
@@ -420,10 +411,7 @@ ClangTidyASTConsumerFactory::createASTConsumer(
420411
.getCurrentWorkingDirectory();
421412
if (WorkingDir)
422413
Context.setCurrentBuildDirectory(WorkingDir.get());
423-
#if CLANG_TIDY_ENABLE_QUERY_BASED_CUSTOM_CHECKS
424-
if (Context.canExperimentalCustomChecks())
425-
custom::registerCustomChecks(Context.getOptions(), *CheckFactories);
426-
#endif
414+
427415
std::vector<std::unique_ptr<ClangTidyCheck>> Checks =
428416
CheckFactories->createChecksForLanguage(&Context);
429417

@@ -509,13 +497,13 @@ ClangTidyOptions::OptionMap ClangTidyASTConsumerFactory::getCheckOptions() {
509497
return Options;
510498
}
511499

512-
std::vector<std::string> getCheckNames(const ClangTidyOptions &Options,
513-
bool AllowEnablingAnalyzerAlphaCheckers,
514-
bool ExperimentalCustomChecks) {
500+
std::vector<std::string>
501+
getCheckNames(const ClangTidyOptions &Options,
502+
bool AllowEnablingAnalyzerAlphaCheckers) {
515503
clang::tidy::ClangTidyContext Context(
516504
std::make_unique<DefaultOptionsProvider>(ClangTidyGlobalOptions(),
517505
Options),
518-
AllowEnablingAnalyzerAlphaCheckers, false, ExperimentalCustomChecks);
506+
AllowEnablingAnalyzerAlphaCheckers);
519507
ClangTidyASTConsumerFactory Factory(Context);
520508
return Factory.getCheckNames();
521509
}
@@ -536,12 +524,11 @@ void filterCheckOptions(ClangTidyOptions &Options,
536524

537525
ClangTidyOptions::OptionMap
538526
getCheckOptions(const ClangTidyOptions &Options,
539-
bool AllowEnablingAnalyzerAlphaCheckers,
540-
bool ExperimentalCustomChecks) {
527+
bool AllowEnablingAnalyzerAlphaCheckers) {
541528
clang::tidy::ClangTidyContext Context(
542529
std::make_unique<DefaultOptionsProvider>(ClangTidyGlobalOptions(),
543530
Options),
544-
AllowEnablingAnalyzerAlphaCheckers, false, ExperimentalCustomChecks);
531+
AllowEnablingAnalyzerAlphaCheckers);
545532
ClangTidyDiagnosticConsumer DiagConsumer(Context);
546533
auto DiagOpts = std::make_unique<DiagnosticOptions>();
547534
DiagnosticsEngine DE(llvm::makeIntrusiveRefCnt<DiagnosticIDs>(), *DiagOpts,
@@ -678,19 +665,15 @@ void exportReplacements(const llvm::StringRef MainFilePath,
678665
YAML << TUD;
679666
}
680667

681-
ChecksAndOptions getAllChecksAndOptions(bool AllowEnablingAnalyzerAlphaCheckers,
682-
bool ExperimentalCustomChecks) {
668+
ChecksAndOptions
669+
getAllChecksAndOptions(bool AllowEnablingAnalyzerAlphaCheckers) {
683670
ChecksAndOptions Result;
684671
ClangTidyOptions Opts;
685672
Opts.Checks = "*";
686673
clang::tidy::ClangTidyContext Context(
687674
std::make_unique<DefaultOptionsProvider>(ClangTidyGlobalOptions(), Opts),
688-
AllowEnablingAnalyzerAlphaCheckers, false, ExperimentalCustomChecks);
675+
AllowEnablingAnalyzerAlphaCheckers);
689676
ClangTidyCheckFactories Factories;
690-
#if CLANG_TIDY_ENABLE_QUERY_BASED_CUSTOM_CHECKS
691-
if (ExperimentalCustomChecks)
692-
custom::registerCustomChecks(Context.getOptions(), Factories);
693-
#endif
694677
for (const ClangTidyModuleRegistry::entry &Module :
695678
ClangTidyModuleRegistry::entries()) {
696679
Module.instantiate()->addCheckFactories(Factories);

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,15 @@ class ClangTidyASTConsumerFactory {
5656
/// Fills the list of check names that are enabled when the provided
5757
/// filters are applied.
5858
std::vector<std::string> getCheckNames(const ClangTidyOptions &Options,
59-
bool AllowEnablingAnalyzerAlphaCheckers,
60-
bool ExperimentalCustomChecks);
59+
bool AllowEnablingAnalyzerAlphaCheckers);
6160

6261
struct ChecksAndOptions {
6362
llvm::StringSet<> Checks;
6463
llvm::StringSet<> Options;
6564
};
6665

67-
ChecksAndOptions getAllChecksAndOptions(bool AllowEnablingAnalyzerAlphaCheckers,
68-
bool ExperimentalCustomChecks);
66+
ChecksAndOptions
67+
getAllChecksAndOptions(bool AllowEnablingAnalyzerAlphaCheckers = true);
6968

7069
/// Returns the effective check-specific options.
7170
///
@@ -75,8 +74,7 @@ ChecksAndOptions getAllChecksAndOptions(bool AllowEnablingAnalyzerAlphaCheckers,
7574
/// Options.
7675
ClangTidyOptions::OptionMap
7776
getCheckOptions(const ClangTidyOptions &Options,
78-
bool AllowEnablingAnalyzerAlphaCheckers,
79-
bool ExperimentalCustomChecks);
77+
bool AllowEnablingAnalyzerAlphaCheckers);
8078

8179
/// Filters CheckOptions in \p Options to only include options specified in
8280
/// the \p EnabledChecks which is a sorted vector.

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,11 @@ ClangTidyError::ClangTidyError(StringRef CheckName,
160160

161161
ClangTidyContext::ClangTidyContext(
162162
std::unique_ptr<ClangTidyOptionsProvider> OptionsProvider,
163-
bool AllowEnablingAnalyzerAlphaCheckers, bool EnableModuleHeadersParsing,
164-
bool ExperimentalCustomChecks)
163+
bool AllowEnablingAnalyzerAlphaCheckers, bool EnableModuleHeadersParsing)
165164
: OptionsProvider(std::move(OptionsProvider)),
165+
166166
AllowEnablingAnalyzerAlphaCheckers(AllowEnablingAnalyzerAlphaCheckers),
167-
EnableModuleHeadersParsing(EnableModuleHeadersParsing),
168-
ExperimentalCustomChecks(ExperimentalCustomChecks) {
167+
EnableModuleHeadersParsing(EnableModuleHeadersParsing) {
169168
// Before the first translation unit we can get errors related to command-line
170169
// parsing, use dummy string for the file name in this case.
171170
setCurrentFile("dummy");

clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.h

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#include "llvm/ADT/StringSet.h"
2020
#include "llvm/Support/Regex.h"
2121
#include <optional>
22-
#include <utility>
2322

2423
namespace clang {
2524

@@ -69,13 +68,10 @@ struct ClangTidyStats {
6968
/// \endcode
7069
class ClangTidyContext {
7170
public:
72-
ClangTidyContext(std::unique_ptr<ClangTidyOptionsProvider> OptionsProvider)
73-
: ClangTidyContext(std::move(OptionsProvider), false, false, false) {}
7471
/// Initializes \c ClangTidyContext instance.
7572
ClangTidyContext(std::unique_ptr<ClangTidyOptionsProvider> OptionsProvider,
76-
bool AllowEnablingAnalyzerAlphaCheckers,
77-
bool EnableModuleHeadersParsing,
78-
bool ExperimentalCustomChecks);
73+
bool AllowEnablingAnalyzerAlphaCheckers = false,
74+
bool EnableModuleHeadersParsing = false);
7975
/// Sets the DiagnosticsEngine that diag() will emit diagnostics to.
8076
// FIXME: this is required initialization, and should be a constructor param.
8177
// Fix the context -> diag engine -> consumer -> context initialization cycle.
@@ -214,10 +210,6 @@ class ClangTidyContext {
214210
return EnableModuleHeadersParsing;
215211
}
216212

217-
// whether experimental custom checks can be enabled.
218-
// enabled with `--experimental-custom-checks`
219-
bool canExperimentalCustomChecks() const { return ExperimentalCustomChecks; }
220-
221213
void setSelfContainedDiags(bool Value) { SelfContainedDiags = Value; }
222214

223215
bool areDiagsSelfContained() const { return SelfContainedDiags; }
@@ -266,7 +258,6 @@ class ClangTidyContext {
266258

267259
bool AllowEnablingAnalyzerAlphaCheckers;
268260
bool EnableModuleHeadersParsing;
269-
bool ExperimentalCustomChecks;
270261

271262
bool SelfContainedDiags = false;
272263

clang-tools-extra/clang-tidy/ClangTidyForceLinker.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,6 @@ extern volatile int CppCoreGuidelinesModuleAnchorSource;
5454
static int LLVM_ATTRIBUTE_UNUSED CppCoreGuidelinesModuleAnchorDestination =
5555
CppCoreGuidelinesModuleAnchorSource;
5656

57-
#if CLANG_TIDY_ENABLE_QUERY_BASED_CUSTOM_CHECKS
58-
// This anchor is used to force the linker to link the CustomModule.
59-
extern volatile int CustomModuleAnchorSource;
60-
static int LLVM_ATTRIBUTE_UNUSED CustomModuleAnchorDestination =
61-
CustomModuleAnchorSource;
62-
#endif
63-
6457
// This anchor is used to force the linker to link the DarwinModule.
6558
extern volatile int DarwinModuleAnchorSource;
6659
static int LLVM_ATTRIBUTE_UNUSED DarwinModuleAnchorDestination =

clang-tools-extra/clang-tidy/ClangTidyModule.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ class ClangTidyCheckFactories {
6262
});
6363
}
6464

65-
void eraseCheck(llvm::StringRef CheckName) { Factories.erase(CheckName); }
66-
6765
/// Create instances of checks that are enabled.
6866
std::vector<std::unique_ptr<ClangTidyCheck>>
6967
createChecks(ClangTidyContext *Context) const;

0 commit comments

Comments
 (0)