Skip to content

Commit 581eb15

Browse files
authored
Merge branch 'main' into sme-bfscale
2 parents 1306c60 + f52b895 commit 581eb15

File tree

1,511 files changed

+212971
-8129
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,511 files changed

+212971
-8129
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ clang_target_link_libraries(clangTidy
3535
clangFrontend
3636
clangLex
3737
clangRewrite
38-
clangSema
3938
clangSerialization
4039
clangTooling
4140
clangToolingCore

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,7 @@ class ClangTidyASTConsumer : public MultiplexConsumer {
336336
std::unique_ptr<ClangTidyProfiling> Profiling;
337337
std::unique_ptr<ast_matchers::MatchFinder> Finder;
338338
std::vector<std::unique_ptr<ClangTidyCheck>> Checks;
339+
void anchor() override {};
339340
};
340341

341342
} // namespace

clang-tools-extra/clang-tidy/readability/ContainerContainsCheck.cpp

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -62,44 +62,44 @@ void ContainerContainsCheck::registerMatchers(MatchFinder *Finder) {
6262
.bind("positiveComparison"),
6363
this);
6464
AddSimpleMatcher(
65-
binaryOperator(hasOperatorName("!="), hasOperands(CountCall, Literal0))
65+
binaryOperation(hasOperatorName("!="), hasOperands(CountCall, Literal0))
6666
.bind("positiveComparison"));
6767
AddSimpleMatcher(
68-
binaryOperator(hasLHS(CountCall), hasOperatorName(">"), hasRHS(Literal0))
68+
binaryOperation(hasLHS(CountCall), hasOperatorName(">"), hasRHS(Literal0))
6969
.bind("positiveComparison"));
7070
AddSimpleMatcher(
71-
binaryOperator(hasLHS(Literal0), hasOperatorName("<"), hasRHS(CountCall))
72-
.bind("positiveComparison"));
73-
AddSimpleMatcher(
74-
binaryOperator(hasLHS(CountCall), hasOperatorName(">="), hasRHS(Literal1))
75-
.bind("positiveComparison"));
76-
AddSimpleMatcher(
77-
binaryOperator(hasLHS(Literal1), hasOperatorName("<="), hasRHS(CountCall))
71+
binaryOperation(hasLHS(Literal0), hasOperatorName("<"), hasRHS(CountCall))
7872
.bind("positiveComparison"));
73+
AddSimpleMatcher(binaryOperation(hasLHS(CountCall), hasOperatorName(">="),
74+
hasRHS(Literal1))
75+
.bind("positiveComparison"));
76+
AddSimpleMatcher(binaryOperation(hasLHS(Literal1), hasOperatorName("<="),
77+
hasRHS(CountCall))
78+
.bind("positiveComparison"));
7979

8080
// Find inverted membership tests which use `count()`.
8181
AddSimpleMatcher(
82-
binaryOperator(hasOperatorName("=="), hasOperands(CountCall, Literal0))
83-
.bind("negativeComparison"));
84-
AddSimpleMatcher(
85-
binaryOperator(hasLHS(CountCall), hasOperatorName("<="), hasRHS(Literal0))
86-
.bind("negativeComparison"));
87-
AddSimpleMatcher(
88-
binaryOperator(hasLHS(Literal0), hasOperatorName(">="), hasRHS(CountCall))
82+
binaryOperation(hasOperatorName("=="), hasOperands(CountCall, Literal0))
8983
.bind("negativeComparison"));
84+
AddSimpleMatcher(binaryOperation(hasLHS(CountCall), hasOperatorName("<="),
85+
hasRHS(Literal0))
86+
.bind("negativeComparison"));
87+
AddSimpleMatcher(binaryOperation(hasLHS(Literal0), hasOperatorName(">="),
88+
hasRHS(CountCall))
89+
.bind("negativeComparison"));
9090
AddSimpleMatcher(
91-
binaryOperator(hasLHS(CountCall), hasOperatorName("<"), hasRHS(Literal1))
91+
binaryOperation(hasLHS(CountCall), hasOperatorName("<"), hasRHS(Literal1))
9292
.bind("negativeComparison"));
9393
AddSimpleMatcher(
94-
binaryOperator(hasLHS(Literal1), hasOperatorName(">"), hasRHS(CountCall))
94+
binaryOperation(hasLHS(Literal1), hasOperatorName(">"), hasRHS(CountCall))
9595
.bind("negativeComparison"));
9696

9797
// Find membership tests based on `find() == end()`.
9898
AddSimpleMatcher(
99-
binaryOperator(hasOperatorName("!="), hasOperands(FindCall, EndCall))
99+
binaryOperation(hasOperatorName("!="), hasOperands(FindCall, EndCall))
100100
.bind("positiveComparison"));
101101
AddSimpleMatcher(
102-
binaryOperator(hasOperatorName("=="), hasOperands(FindCall, EndCall))
102+
binaryOperation(hasOperatorName("=="), hasOperands(FindCall, EndCall))
103103
.bind("negativeComparison"));
104104
}
105105

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,8 @@ Changes in existing checks
238238

239239
- Improved :doc:`readability-container-contains
240240
<clang-tidy/checks/readability/container-contains>` check to let it work on
241-
any class that has a ``contains`` method.
241+
any class that has a ``contains`` method. Fix some false negatives in the
242+
``find()`` case.
242243

243244
- Improved :doc:`readability-enum-initial-value
244245
<clang-tidy/checks/readability/enum-initial-value>` check by only issuing

clang-tools-extra/test/clang-tidy/checkers/readability/container-contains.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
1-
// RUN: %check_clang_tidy -std=c++20-or-later %s readability-container-contains %t
1+
// RUN: %check_clang_tidy -std=c++11-or-later %s readability-container-contains %t
22

33
// Some *very* simplified versions of `map` etc.
44
namespace std {
55

66
template <class Key, class T>
77
struct map {
8+
struct iterator {
9+
bool operator==(const iterator &Other) const;
10+
bool operator!=(const iterator &Other) const;
11+
};
12+
813
unsigned count(const Key &K) const;
914
bool contains(const Key &K) const;
10-
void *find(const Key &K);
11-
void *end();
15+
iterator find(const Key &K);
16+
iterator end();
1217
};
1318

1419
template <class Key>

clang/docs/ClangFormatStyleOptions.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4663,6 +4663,14 @@ the configuration (without a prefix: ``Auto``).
46634663
**KeepEmptyLinesAtTheStartOfBlocks** (``Boolean``) :versionbadge:`clang-format 3.7` :ref:`<KeepEmptyLinesAtTheStartOfBlocks>`
46644664
This option is deprecated. See ``AtStartOfBlock`` of ``KeepEmptyLines``.
46654665

4666+
.. _KeepFormFeed:
4667+
4668+
**KeepFormFeed** (``Boolean``) :versionbadge:`clang-format 20` :ref:`<KeepFormFeed>`
4669+
Keep the form feed character if it's immediately preceded and followed by
4670+
a newline. Multiple form feeds and newlines within a whitespace range are
4671+
replaced with a single newline and form feed followed by the remaining
4672+
newlines.
4673+
46664674
.. _LambdaBodyIndentation:
46674675

46684676
**LambdaBodyIndentation** (``LambdaBodyIndentationKind``) :versionbadge:`clang-format 13` :ref:`<LambdaBodyIndentation>`

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,7 @@ Bug Fixes to C++ Support
544544
- Clang incorrectly considered a class with an anonymous union member to not be
545545
const-default-constructible even if a union member has a default member initializer.
546546
(#GH95854).
547+
- Fixed an assertion failure when evaluating an invalid expression in an array initializer (#GH112140)
547548

548549
Bug Fixes to AST Handling
549550
^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -710,6 +711,7 @@ clang-format
710711
multi-line comments without touching their contents, renames ``false`` to
711712
``Never``, and ``true`` to ``Always``.
712713
- Adds ``RemoveEmptyLinesInUnwrappedLines`` option.
714+
- Adds ``KeepFormFeed`` option and set it to ``true`` for ``GNU`` style.
713715

714716
libclang
715717
--------

clang/include/clang/AST/CommentSema.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class Sema {
8080
ArrayRef<T> copyArray(ArrayRef<T> Source) {
8181
if (!Source.empty())
8282
return Source.copy(Allocator);
83-
return std::nullopt;
83+
return {};
8484
}
8585

8686
ParagraphComment *actOnParagraphComment(

clang/include/clang/AST/DeclFriend.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class FriendDecl final
115115
static FriendDecl *
116116
Create(ASTContext &C, DeclContext *DC, SourceLocation L, FriendUnion Friend_,
117117
SourceLocation FriendL, SourceLocation EllipsisLoc = {},
118-
ArrayRef<TemplateParameterList *> FriendTypeTPLists = std::nullopt);
118+
ArrayRef<TemplateParameterList *> FriendTypeTPLists = {});
119119
static FriendDecl *CreateDeserialized(ASTContext &C, GlobalDeclID ID,
120120
unsigned FriendTypeNumTPLists);
121121

clang/include/clang/AST/DeclObjC.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ class ObjCMethodDecl : public NamedDecl, public DeclContext {
386386
/// If the method is implicit (not coming from source) \p SelLocs is
387387
/// ignored.
388388
void setMethodParams(ASTContext &C, ArrayRef<ParmVarDecl *> Params,
389-
ArrayRef<SourceLocation> SelLocs = std::nullopt);
389+
ArrayRef<SourceLocation> SelLocs = {});
390390

391391
// Iterator access to parameter types.
392392
struct GetTypeFn {

0 commit comments

Comments
 (0)