Skip to content

Commit de4fb9a

Browse files
authored
Merge branch 'main' into uses_allocator_syntax
2 parents 51f5f07 + 7731ecf commit de4fb9a

File tree

1,706 files changed

+56694
-34410
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,706 files changed

+56694
-34410
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

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
/runtimes/ @llvm/reviewers-libcxx
1818

1919
/llvm/lib/Analysis/BasicAliasAnalysis.cpp @nikic
20+
/llvm/lib/Analysis/HashRecognize.cpp @artagnon @pfusik
2021
/llvm/lib/Analysis/InstructionSimplify.cpp @nikic
2122
/llvm/lib/Analysis/LazyValueInfo.cpp @nikic
2223
/llvm/lib/Analysis/ScalarEvolution.cpp @nikic

bolt/lib/Core/BinaryContext.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,15 +207,15 @@ Expected<std::unique_ptr<BinaryContext>> BinaryContext::createBinaryContext(
207207
Twine("BOLT-ERROR: ", Error));
208208

209209
std::unique_ptr<const MCRegisterInfo> MRI(
210-
TheTarget->createMCRegInfo(TripleName));
210+
TheTarget->createMCRegInfo(TheTriple));
211211
if (!MRI)
212212
return createStringError(
213213
make_error_code(std::errc::not_supported),
214214
Twine("BOLT-ERROR: no register info for target ", TripleName));
215215

216216
// Set up disassembler.
217217
std::unique_ptr<MCAsmInfo> AsmInfo(
218-
TheTarget->createMCAsmInfo(*MRI, TripleName, MCTargetOptions()));
218+
TheTarget->createMCAsmInfo(*MRI, TheTriple, MCTargetOptions()));
219219
if (!AsmInfo)
220220
return createStringError(
221221
make_error_code(std::errc::not_supported),
@@ -227,7 +227,7 @@ Expected<std::unique_ptr<BinaryContext>> BinaryContext::createBinaryContext(
227227
AsmInfo->setAllowAtInName(true);
228228

229229
std::unique_ptr<const MCSubtargetInfo> STI(
230-
TheTarget->createMCSubtargetInfo(TripleName, "", FeaturesStr));
230+
TheTarget->createMCSubtargetInfo(TheTriple, "", FeaturesStr));
231231
if (!STI)
232232
return createStringError(
233233
make_error_code(std::errc::not_supported),

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ Checks: >
1111
modernize-*,
1212
-modernize-avoid-c-arrays,
1313
-modernize-pass-by-value,
14-
-modernize-use-auto,
1514
-modernize-use-nodiscard,
1615
-modernize-use-trailing-return-type,
1716
performance-*,
@@ -22,7 +21,6 @@ Checks: >
2221
readability-*,
2322
-readability-avoid-nested-conditional-operator,
2423
-readability-braces-around-statements,
25-
-readability-container-contains,
2624
-readability-convert-member-functions-to-static,
2725
-readability-else-after-return,
2826
-readability-function-cognitive-complexity,

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

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,6 @@ ClangTidyCheck::OptionsView::get(StringRef LocalName) const {
6262
return std::nullopt;
6363
}
6464

65-
static const llvm::StringSet<> DeprecatedGlobalOptions{
66-
"StrictMode",
67-
"IgnoreMacros",
68-
};
69-
7065
static ClangTidyOptions::OptionMap::const_iterator
7166
findPriorityOption(const ClangTidyOptions::OptionMap &Options,
7267
StringRef NamePrefix, StringRef LocalName,
@@ -78,13 +73,6 @@ findPriorityOption(const ClangTidyOptions::OptionMap &Options,
7873
}
7974
auto IterLocal = Options.find((NamePrefix + LocalName).str());
8075
auto IterGlobal = Options.find(LocalName);
81-
// FIXME: temporary solution for deprecation warnings, should be removed
82-
// after 22.x. Warn configuration deps on deprecation global options.
83-
if (IterLocal == Options.end() && IterGlobal != Options.end() &&
84-
DeprecatedGlobalOptions.contains(LocalName))
85-
Context->configurationDiag(
86-
"global option '%0' is deprecated, please use '%1%0' instead.")
87-
<< LocalName << NamePrefix;
8876
if (IterLocal == Options.end())
8977
return IterGlobal;
9078
if (IterGlobal == Options.end())

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class ExpandModularHeadersPPCallbacks::FileRecorder {
3535
const SrcMgr::ContentCache &ContentCache,
3636
llvm::vfs::InMemoryFileSystem &InMemoryFs) {
3737
// Return if we are not interested in the contents of this file.
38-
if (!FilesToRecord.count(File))
38+
if (!FilesToRecord.contains(File))
3939
return;
4040

4141
// FIXME: Why is this happening? We might be losing contents here.

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

Lines changed: 55 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,9 @@
2525
#include "llvm/ADT/StringSwitch.h"
2626
#include <cassert>
2727
#include <cstddef>
28-
#include <iterator>
28+
#include <memory>
2929
#include <optional>
3030
#include <string>
31-
#include <tuple>
3231
#include <utility>
3332

3433
namespace clang::tidy {
@@ -79,7 +78,7 @@ class NoLintToken {
7978
// - An empty string means nothing is suppressed - equivalent to NOLINT().
8079
// - Negative globs ignored (which would effectively disable the suppression).
8180
NoLintToken(NoLintType Type, size_t Pos,
82-
const std::optional<std::string> &Checks)
81+
const std::optional<StringRef> &Checks)
8382
: Type(Type), Pos(Pos), ChecksGlob(std::make_unique<CachedGlobList>(
8483
Checks.value_or("*"),
8584
/*KeepNegativeGlobs=*/false)) {
@@ -93,15 +92,17 @@ class NoLintToken {
9392
// The location of the first character, "N", in "NOLINT".
9493
size_t Pos;
9594

95+
// A glob of the checks this NOLINT token disables.
96+
std::unique_ptr<CachedGlobList> ChecksGlob;
97+
9698
// If this NOLINT specifies checks, return the checks.
97-
std::optional<std::string> checks() const { return Checks; }
99+
const std::optional<std::string> &checks() const { return Checks; }
98100

99101
// Whether this NOLINT applies to the provided check.
100102
bool suppresses(StringRef Check) const { return ChecksGlob->contains(Check); }
101103

102104
private:
103105
std::optional<std::string> Checks;
104-
std::unique_ptr<CachedGlobList> ChecksGlob;
105106
};
106107

107108
} // namespace
@@ -131,11 +132,11 @@ static SmallVector<NoLintToken> getNoLints(StringRef Buffer) {
131132
continue;
132133

133134
// Get checks, if specified.
134-
std::optional<std::string> Checks;
135+
std::optional<StringRef> Checks;
135136
if (Pos < Buffer.size() && Buffer[Pos] == '(') {
136137
size_t ClosingBracket = Buffer.find_first_of("\n)", ++Pos);
137138
if (ClosingBracket != StringRef::npos && Buffer[ClosingBracket] == ')') {
138-
Checks = Buffer.slice(Pos, ClosingBracket).str();
139+
Checks = Buffer.slice(Pos, ClosingBracket);
139140
Pos = ClosingBracket + 1;
140141
}
141142
}
@@ -155,34 +156,51 @@ namespace {
155156
// Represents a source range within a pair of NOLINT(BEGIN/END) comments.
156157
class NoLintBlockToken {
157158
public:
158-
NoLintBlockToken(NoLintToken Begin, const NoLintToken &End)
159-
: Begin(std::move(Begin)), EndPos(End.Pos) {
160-
assert(this->Begin.Type == NoLintType::NoLintBegin);
161-
assert(End.Type == NoLintType::NoLintEnd);
162-
assert(this->Begin.Pos < End.Pos);
163-
assert(this->Begin.checks() == End.checks());
164-
}
159+
NoLintBlockToken(size_t BeginPos, size_t EndPos,
160+
std::unique_ptr<CachedGlobList> ChecksGlob)
161+
: BeginPos(BeginPos), EndPos(EndPos), ChecksGlob(std::move(ChecksGlob)) {}
165162

166163
// Whether the provided diagnostic is within and is suppressible by this block
167164
// of NOLINT(BEGIN/END) comments.
168165
bool suppresses(size_t DiagPos, StringRef DiagName) const {
169-
return (Begin.Pos < DiagPos) && (DiagPos < EndPos) &&
170-
Begin.suppresses(DiagName);
166+
return (BeginPos < DiagPos) && (DiagPos < EndPos) &&
167+
ChecksGlob->contains(DiagName);
171168
}
172169

173170
private:
174-
NoLintToken Begin;
171+
size_t BeginPos;
175172
size_t EndPos;
173+
std::unique_ptr<CachedGlobList> ChecksGlob;
176174
};
177175

178176
} // namespace
179177

178+
// Construct a [clang-tidy-nolint] diagnostic to do with the unmatched
179+
// NOLINT(BEGIN/END) pair.
180+
static tooling::Diagnostic makeNoLintError(const SourceManager &SrcMgr,
181+
FileID File,
182+
const NoLintToken &NoLint) {
183+
tooling::Diagnostic Error;
184+
Error.DiagLevel = tooling::Diagnostic::Error;
185+
Error.DiagnosticName = "clang-tidy-nolint";
186+
StringRef Message =
187+
(NoLint.Type == NoLintType::NoLintBegin)
188+
? ("unmatched 'NOLINTBEGIN' comment without a subsequent 'NOLINT"
189+
"END' comment")
190+
: ("unmatched 'NOLINTEND' comment without a previous 'NOLINT"
191+
"BEGIN' comment");
192+
SourceLocation Loc = SrcMgr.getComposedLoc(File, NoLint.Pos);
193+
Error.Message = tooling::DiagnosticMessage(Message, SrcMgr, Loc);
194+
return Error;
195+
}
196+
180197
// Match NOLINTBEGINs with their corresponding NOLINTENDs and move them into
181-
// `NoLintBlockToken`s. If any BEGINs or ENDs are left over, they are moved to
182-
// `UnmatchedTokens`.
198+
// `NoLintBlockToken`s. If any BEGINs or ENDs are left over, a diagnostic is
199+
// written to `NoLintErrors`.
183200
static SmallVector<NoLintBlockToken>
184-
formNoLintBlocks(SmallVector<NoLintToken> NoLints,
185-
SmallVectorImpl<NoLintToken> &UnmatchedTokens) {
201+
formNoLintBlocks(SmallVector<NoLintToken> NoLints, const SourceManager &SrcMgr,
202+
FileID File,
203+
SmallVectorImpl<tooling::Diagnostic> &NoLintErrors) {
186204
SmallVector<NoLintBlockToken> CompletedBlocks;
187205
SmallVector<NoLintToken> Stack;
188206

@@ -196,16 +214,20 @@ formNoLintBlocks(SmallVector<NoLintToken> NoLints,
196214
// A new block is being started. Add it to the stack.
197215
Stack.emplace_back(std::move(NoLint));
198216
else if (NoLint.Type == NoLintType::NoLintEnd) {
199-
if (!Stack.empty() && Stack.back().checks() == NoLint.checks())
217+
if (!Stack.empty() && Stack.back().checks() == NoLint.checks()) {
200218
// The previous block is being closed. Pop one element off the stack.
201-
CompletedBlocks.emplace_back(Stack.pop_back_val(), NoLint);
202-
else
219+
CompletedBlocks.emplace_back(Stack.back().Pos, NoLint.Pos,
220+
std::move(Stack.back().ChecksGlob));
221+
Stack.pop_back();
222+
} else
203223
// Trying to close the wrong block.
204-
UnmatchedTokens.emplace_back(std::move(NoLint));
224+
NoLintErrors.emplace_back(makeNoLintError(SrcMgr, File, NoLint));
205225
}
206226
}
207227

208-
llvm::move(Stack, std::back_inserter(UnmatchedTokens));
228+
for (const NoLintToken &NoLint : Stack)
229+
NoLintErrors.emplace_back(makeNoLintError(SrcMgr, File, NoLint));
230+
209231
return CompletedBlocks;
210232
}
211233

@@ -274,7 +296,7 @@ static std::pair<size_t, size_t> getLineStartAndEnd(StringRef Buffer,
274296
size_t From) {
275297
size_t StartPos = Buffer.find_last_of('\n', From) + 1;
276298
size_t EndPos = std::min(Buffer.find('\n', From), Buffer.size());
277-
return std::make_pair(StartPos, EndPos);
299+
return {StartPos, EndPos};
278300
}
279301

280302
// Whether the line has a NOLINT of type = `Type` that can suppress the
@@ -317,9 +339,7 @@ bool NoLintDirectiveHandler::Impl::diagHasNoLint(
317339
SmallVectorImpl<tooling::Diagnostic> &NoLintErrors, bool AllowIO,
318340
bool EnableNoLintBlocks) {
319341
// Translate the diagnostic's SourceLocation to a raw file + offset pair.
320-
FileID File;
321-
unsigned int Pos = 0;
322-
std::tie(File, Pos) = SrcMgr.getDecomposedSpellingLoc(DiagLoc);
342+
const auto [File, Pos] = SrcMgr.getDecomposedSpellingLoc(DiagLoc);
323343

324344
// We will only see NOLINTs in user-authored sources. No point reading the
325345
// file if it is a <built-in>.
@@ -349,46 +369,21 @@ bool NoLintDirectiveHandler::Impl::diagHasNoLint(
349369
return false;
350370

351371
// Do we have cached NOLINT block locations for this file?
352-
if (Cache.count(*FileName) == 0)
372+
if (!Cache.contains(*FileName))
353373
// Warning: heavy operation - need to read entire file.
354374
generateCache(SrcMgr, *FileName, File, *Buffer, NoLintErrors);
355375

356376
return withinNoLintBlock(Cache[*FileName], Pos, DiagName);
357377
}
358378

359-
// Construct a [clang-tidy-nolint] diagnostic to do with the unmatched
360-
// NOLINT(BEGIN/END) pair.
361-
static tooling::Diagnostic makeNoLintError(const SourceManager &SrcMgr,
362-
FileID File,
363-
const NoLintToken &NoLint) {
364-
tooling::Diagnostic Error;
365-
Error.DiagLevel = tooling::Diagnostic::Error;
366-
Error.DiagnosticName = "clang-tidy-nolint";
367-
StringRef Message =
368-
(NoLint.Type == NoLintType::NoLintBegin)
369-
? ("unmatched 'NOLINTBEGIN' comment without a subsequent 'NOLINT"
370-
"END' comment")
371-
: ("unmatched 'NOLINTEND' comment without a previous 'NOLINT"
372-
"BEGIN' comment");
373-
SourceLocation Loc = SrcMgr.getComposedLoc(File, NoLint.Pos);
374-
Error.Message = tooling::DiagnosticMessage(Message, SrcMgr, Loc);
375-
return Error;
376-
}
377-
378379
// Find all NOLINT(BEGIN/END) blocks in a file and store in the cache.
379380
void NoLintDirectiveHandler::Impl::generateCache(
380381
const SourceManager &SrcMgr, StringRef FileName, FileID File,
381382
StringRef Buffer, SmallVectorImpl<tooling::Diagnostic> &NoLintErrors) {
382-
// Read entire file to get all NOLINTs.
383-
SmallVector<NoLintToken> NoLints = getNoLints(Buffer);
384-
385-
// Match each BEGIN with its corresponding END.
386-
SmallVector<NoLintToken> UnmatchedTokens;
387-
Cache[FileName] = formNoLintBlocks(std::move(NoLints), UnmatchedTokens);
388-
389-
// Raise error for any BEGIN/END left over.
390-
for (const NoLintToken &NoLint : UnmatchedTokens)
391-
NoLintErrors.emplace_back(makeNoLintError(SrcMgr, File, NoLint));
383+
// Read entire file to get all NOLINTs and match each BEGIN with its
384+
// corresponding END, raising errors for any BEGIN or END that is unmatched.
385+
Cache.try_emplace(FileName, formNoLintBlocks(getNoLints(Buffer), SrcMgr, File,
386+
NoLintErrors));
392387
}
393388

394389
//===----------------------------------------------------------------------===//

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ class NoLintDirectiveHandler {
3131
public:
3232
NoLintDirectiveHandler();
3333
~NoLintDirectiveHandler();
34-
NoLintDirectiveHandler(const NoLintDirectiveHandler &) = delete;
35-
NoLintDirectiveHandler &operator=(const NoLintDirectiveHandler &) = delete;
3634

3735
bool shouldSuppress(DiagnosticsEngine::Level DiagLevel,
3836
const Diagnostic &Diag, llvm::StringRef DiagName,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ void UpgradeDurationConversionsCheck::check(
126126

127127
if (!match(isInTemplateInstantiation(), *OuterExpr, *Result.Context)
128128
.empty()) {
129-
if (MatchedTemplateLocations.count(Loc) == 0) {
129+
if (!MatchedTemplateLocations.contains(Loc)) {
130130
// For each location matched in a template instantiation, we check if the
131131
// location can also be found in `MatchedTemplateLocations`. If it is not
132132
// found, that means the expression did not create a match without the

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ AST_MATCHER(Decl, isFromStdNamespaceOrSystemHeader) {
3232
ArgumentCommentCheck::ArgumentCommentCheck(StringRef Name,
3333
ClangTidyContext *Context)
3434
: ClangTidyCheck(Name, Context),
35-
StrictMode(Options.getLocalOrGlobal("StrictMode", false)),
35+
StrictMode(Options.get("StrictMode", false)),
3636
IgnoreSingleArgument(Options.get("IgnoreSingleArgument", false)),
3737
CommentBoolLiterals(Options.get("CommentBoolLiterals", false)),
3838
CommentIntegerLiterals(Options.get("CommentIntegerLiterals", false)),

0 commit comments

Comments
 (0)