Skip to content

Commit cba781a

Browse files
Address review feedback
Created using spr 1.3.6
2 parents f4d0f36 + 53a18eb commit cba781a

File tree

1,811 files changed

+55990
-34324
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,811 files changed

+55990
-34324
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()

.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

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/ClangTidyOptions.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ void yamlize(IO &IO, ClangTidyOptions::OptionMap &Val, bool,
9999
for (auto &Option : SortedOptions) {
100100
bool UseDefault = false;
101101
void *SaveInfo = nullptr;
102+
// Requires 'llvm::yaml::IO' to accept 'StringRef'
103+
// NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
102104
IO.preflightKey(Option.first.data(), true, false, UseDefault, SaveInfo);
103105
IO.scalarString(Option.second, needsQuotes(Option.second));
104106
IO.postflightKey(SaveInfo);
@@ -116,6 +118,8 @@ void yamlize(IO &IO, ClangTidyOptions::OptionMap &Val, bool,
116118
} else if (isa<MappingNode>(I.getCurrentNode())) {
117119
IO.beginMapping();
118120
for (StringRef Key : IO.keys()) {
121+
// Requires 'llvm::yaml::IO' to accept 'StringRef'
122+
// NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
119123
IO.mapRequired(Key.data(), Val[Key].Value);
120124
}
121125
IO.endMapping();

clang-tools-extra/clang-tidy/abseil/DurationRewriter.cpp

Lines changed: 30 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,17 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
#include <array>
910
#include <cmath>
1011
#include <optional>
1112

1213
#include "DurationRewriter.h"
1314
#include "clang/Tooling/FixIt.h"
14-
#include "llvm/ADT/IndexedMap.h"
1515

1616
using namespace clang::ast_matchers;
1717

1818
namespace clang::tidy::abseil {
1919

20-
struct DurationScale2IndexFunctor {
21-
using argument_type = DurationScale;
22-
unsigned operator()(DurationScale Scale) const {
23-
return static_cast<unsigned>(Scale);
24-
}
25-
};
26-
2720
/// Returns an integer if the fractional part of a `FloatingLiteral` is `0`.
2821
static std::optional<llvm::APSInt>
2922
truncateIfIntegral(const FloatingLiteral &FloatLiteral) {
@@ -39,31 +32,17 @@ truncateIfIntegral(const FloatingLiteral &FloatLiteral) {
3932

4033
const std::pair<llvm::StringRef, llvm::StringRef> &
4134
getDurationInverseForScale(DurationScale Scale) {
42-
static const llvm::IndexedMap<std::pair<llvm::StringRef, llvm::StringRef>,
43-
DurationScale2IndexFunctor>
44-
InverseMap = []() {
45-
// TODO: Revisit the immediately invoked lambda technique when
46-
// IndexedMap gets an initializer list constructor.
47-
llvm::IndexedMap<std::pair<llvm::StringRef, llvm::StringRef>,
48-
DurationScale2IndexFunctor>
49-
InverseMap;
50-
InverseMap.resize(6);
51-
InverseMap[DurationScale::Hours] =
52-
std::make_pair("::absl::ToDoubleHours", "::absl::ToInt64Hours");
53-
InverseMap[DurationScale::Minutes] =
54-
std::make_pair("::absl::ToDoubleMinutes", "::absl::ToInt64Minutes");
55-
InverseMap[DurationScale::Seconds] =
56-
std::make_pair("::absl::ToDoubleSeconds", "::absl::ToInt64Seconds");
57-
InverseMap[DurationScale::Milliseconds] = std::make_pair(
58-
"::absl::ToDoubleMilliseconds", "::absl::ToInt64Milliseconds");
59-
InverseMap[DurationScale::Microseconds] = std::make_pair(
60-
"::absl::ToDoubleMicroseconds", "::absl::ToInt64Microseconds");
61-
InverseMap[DurationScale::Nanoseconds] = std::make_pair(
62-
"::absl::ToDoubleNanoseconds", "::absl::ToInt64Nanoseconds");
63-
return InverseMap;
64-
}();
65-
66-
return InverseMap[Scale];
35+
static constexpr std::array<std::pair<llvm::StringRef, llvm::StringRef>, 6>
36+
InverseMap = {{
37+
{"::absl::ToDoubleHours", "::absl::ToInt64Hours"},
38+
{"::absl::ToDoubleMinutes", "::absl::ToInt64Minutes"},
39+
{"::absl::ToDoubleSeconds", "::absl::ToInt64Seconds"},
40+
{"::absl::ToDoubleMilliseconds", "::absl::ToInt64Milliseconds"},
41+
{"::absl::ToDoubleMicroseconds", "::absl::ToInt64Microseconds"},
42+
{"::absl::ToDoubleNanoseconds", "::absl::ToInt64Nanoseconds"},
43+
}};
44+
45+
return InverseMap[llvm::to_underlying(Scale)];
6746
}
6847

6948
/// If `Node` is a call to the inverse of `Scale`, return that inverse's
@@ -103,58 +82,31 @@ rewriteInverseTimeCall(const MatchFinder::MatchResult &Result,
10382

10483
/// Returns the factory function name for a given `Scale`.
10584
llvm::StringRef getDurationFactoryForScale(DurationScale Scale) {
106-
switch (Scale) {
107-
case DurationScale::Hours:
108-
return "absl::Hours";
109-
case DurationScale::Minutes:
110-
return "absl::Minutes";
111-
case DurationScale::Seconds:
112-
return "absl::Seconds";
113-
case DurationScale::Milliseconds:
114-
return "absl::Milliseconds";
115-
case DurationScale::Microseconds:
116-
return "absl::Microseconds";
117-
case DurationScale::Nanoseconds:
118-
return "absl::Nanoseconds";
119-
}
120-
llvm_unreachable("unknown scaling factor");
85+
static constexpr std::array<llvm::StringRef, 6> FactoryMap = {
86+
"absl::Hours", "absl::Minutes", "absl::Seconds",
87+
"absl::Milliseconds", "absl::Microseconds", "absl::Nanoseconds",
88+
};
89+
90+
return FactoryMap[llvm::to_underlying(Scale)];
12191
}
12292

12393
llvm::StringRef getTimeFactoryForScale(DurationScale Scale) {
124-
switch (Scale) {
125-
case DurationScale::Hours:
126-
return "absl::FromUnixHours";
127-
case DurationScale::Minutes:
128-
return "absl::FromUnixMinutes";
129-
case DurationScale::Seconds:
130-
return "absl::FromUnixSeconds";
131-
case DurationScale::Milliseconds:
132-
return "absl::FromUnixMillis";
133-
case DurationScale::Microseconds:
134-
return "absl::FromUnixMicros";
135-
case DurationScale::Nanoseconds:
136-
return "absl::FromUnixNanos";
137-
}
138-
llvm_unreachable("unknown scaling factor");
94+
static constexpr std::array<llvm::StringRef, 6> FactoryMap = {
95+
"absl::FromUnixHours", "absl::FromUnixMinutes", "absl::FromUnixSeconds",
96+
"absl::FromUnixMillis", "absl::FromUnixMicros", "absl::FromUnixNanos",
97+
};
98+
99+
return FactoryMap[llvm::to_underlying(Scale)];
139100
}
140101

141102
/// Returns the Time factory function name for a given `Scale`.
142103
llvm::StringRef getTimeInverseForScale(DurationScale Scale) {
143-
switch (Scale) {
144-
case DurationScale::Hours:
145-
return "absl::ToUnixHours";
146-
case DurationScale::Minutes:
147-
return "absl::ToUnixMinutes";
148-
case DurationScale::Seconds:
149-
return "absl::ToUnixSeconds";
150-
case DurationScale::Milliseconds:
151-
return "absl::ToUnixMillis";
152-
case DurationScale::Microseconds:
153-
return "absl::ToUnixMicros";
154-
case DurationScale::Nanoseconds:
155-
return "absl::ToUnixNanos";
156-
}
157-
llvm_unreachable("unknown scaling factor");
104+
static constexpr std::array<llvm::StringRef, 6> InverseMap = {
105+
"absl::ToUnixHours", "absl::ToUnixMinutes", "absl::ToUnixSeconds",
106+
"absl::ToUnixMillis", "absl::ToUnixMicros", "absl::ToUnixNanos",
107+
};
108+
109+
return InverseMap[llvm::to_underlying(Scale)];
158110
}
159111

160112
/// Returns `true` if `Node` is a value which evaluates to a literal `0`.

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "CopyConstructorInitCheck.h"
2424
#include "CrtpConstructorAccessibilityCheck.h"
2525
#include "DanglingHandleCheck.h"
26+
#include "DerivedMethodShadowingBaseMethodCheck.h"
2627
#include "DynamicStaticInitializersCheck.h"
2728
#include "EasilySwappableParametersCheck.h"
2829
#include "EmptyCatchCheck.h"
@@ -134,6 +135,8 @@ class BugproneModule : public ClangTidyModule {
134135
"bugprone-copy-constructor-init");
135136
CheckFactories.registerCheck<DanglingHandleCheck>(
136137
"bugprone-dangling-handle");
138+
CheckFactories.registerCheck<DerivedMethodShadowingBaseMethodCheck>(
139+
"bugprone-derived-method-shadowing-base-method");
137140
CheckFactories.registerCheck<DynamicStaticInitializersCheck>(
138141
"bugprone-dynamic-static-initializers");
139142
CheckFactories.registerCheck<EasilySwappableParametersCheck>(

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ add_clang_library(clangTidyBugproneModule STATIC
1919
CopyConstructorInitCheck.cpp
2020
CrtpConstructorAccessibilityCheck.cpp
2121
DanglingHandleCheck.cpp
22+
DerivedMethodShadowingBaseMethodCheck.cpp
2223
DynamicStaticInitializersCheck.cpp
2324
EasilySwappableParametersCheck.cpp
2425
EmptyCatchCheck.cpp

0 commit comments

Comments
 (0)