Skip to content

Commit 4489e86

Browse files
Merge branch 'llvm:main' into gh-101657
2 parents c33cc6e + 1c76958 commit 4489e86

File tree

387 files changed

+12128
-2496
lines changed

Some content is hidden

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

387 files changed

+12128
-2496
lines changed

clang-tools-extra/CODE_OWNERS.TXT

Lines changed: 0 additions & 30 deletions
This file was deleted.

clang-tools-extra/Maintainers.txt

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
=============================
2+
Clang Tools Extra Maintainers
3+
=============================
4+
5+
This file is a list of the maintainers
6+
(https://llvm.org/docs/DeveloperPolicy.html#maintainers) for clang-tools-extra.
7+
8+
9+
Active Maintainers
10+
==================
11+
The following people are the active maintainers for the project. Please reach
12+
out to them for code reviews, questions about their area of expertise, or other
13+
assistance.
14+
15+
Lead Maintainer
16+
---------------
17+
| Aaron Ballman
18+
| [email protected] (email), aaron.ballman (Phabricator), AaronBallman (GitHub), AaronBallman (Discourse), aaronballman (Discord), AaronBallman (IRC)
19+
20+
21+
clang-tidy
22+
----------
23+
| Congcong Cai
24+
| [email protected] (email), HerrCai0907 (GitHub), HerrCai0907 (Discourse)
25+
26+
| Julian Schmidt
27+
| [email protected] (email), 5chmidti (GitHub), 5chmidti (Discourse), 5chmidti (Discord)
28+
29+
| Piotr Zegar
30+
| [email protected] (email), PiotrZSL (GitHub), PiotrZSL (Discourse), PiotrZSL (Discord)
31+
32+
33+
clang-query
34+
-----------
35+
| Aaron Ballman
36+
| [email protected] (email), aaron.ballman (Phabricator), AaronBallman (GitHub), AaronBallman (Discourse), aaronballman (Discord), AaronBallman (IRC)
37+
38+
39+
clang-doc
40+
---------
41+
| Paul Kirth
42+
| [email protected] (email), ilovepi (GitHub), ilovepi (Discourse)
43+
44+
| Peter Chou
45+
| [email protected] (email), PeterChou1 (GitHub), PeterChou1 (Discourse), .peterchou (Discord)
46+
47+
48+
clangd
49+
------
50+
| Nathan Ridge
51+
| [email protected] (email), HighCommander4 (GitHub), HighCommander4 (Discourse), nridge (Discord)
52+
53+
| Chris Bieneman
54+
| [email protected] (email), llvm-beanz (GitHub), beanz (Discord), beanz (Discourse)
55+
56+
| Kadir Çetinkaya
57+
| [email protected] (email), kadircet (GitHub) kadircet (Discourse), kadircet (Discord)
58+
59+
60+
Inactive Maintainers
61+
====================
62+
The following people have graciously spent time performing maintainership
63+
responsibilities but are no longer active in that role. Thank you for all your
64+
help with the success of the project!
65+
66+
Emeritus Lead Maintainers
67+
-------------------------
68+
| Manuel Klimek ([email protected] (email), r4nt (GitHub))
69+
70+
71+
Inactive component maintainers
72+
------------------------------
73+
| Nathan James ([email protected]) -- clang-tidy
74+
| Julie Hockett ([email protected]) -- clang-doc
75+
| Sam McCall ([email protected] (email), sam-mccall (GitHub, Discourse, Discord)) -- clangd

clang-tools-extra/clang-tidy/modernize/UseStartsEndsWithCheck.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,16 @@ using namespace clang::ast_matchers;
2020
namespace clang::tidy::modernize {
2121

2222
static bool isNegativeComparison(const Expr *ComparisonExpr) {
23-
if (const auto *BO = llvm::dyn_cast<BinaryOperator>(ComparisonExpr))
24-
return BO->getOpcode() == BO_NE;
23+
if (const auto *Op = llvm::dyn_cast<BinaryOperator>(ComparisonExpr))
24+
return Op->getOpcode() == BO_NE;
2525

2626
if (const auto *Op = llvm::dyn_cast<CXXOperatorCallExpr>(ComparisonExpr))
2727
return Op->getOperator() == OO_ExclaimEqual;
2828

29+
if (const auto *Op =
30+
llvm::dyn_cast<CXXRewrittenBinaryOperator>(ComparisonExpr))
31+
return Op->getOperator() == BO_NE;
32+
2933
return false;
3034
}
3135

@@ -185,7 +189,7 @@ void UseStartsEndsWithCheck::registerMatchers(MatchFinder *Finder) {
185189

186190
// Case 6: X.substr(0, LEN(Y)) [!=]= Y -> starts_with.
187191
Finder->addMatcher(
188-
cxxOperatorCallExpr(
192+
binaryOperation(
189193
hasAnyOperatorName("==", "!="),
190194
hasOperands(
191195
expr().bind("needle"),

clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/string

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,6 @@ bool operator==(const std::string&, const std::string&);
136136
bool operator==(const std::string&, const char*);
137137
bool operator==(const char*, const std::string&);
138138

139-
bool operator!=(const std::string&, const std::string&);
140-
bool operator!=(const std::string&, const char*);
141-
bool operator!=(const char*, const std::string&);
142-
143139
bool operator==(const std::wstring&, const std::wstring&);
144140
bool operator==(const std::wstring&, const wchar_t*);
145141
bool operator==(const wchar_t*, const std::wstring&);
@@ -148,9 +144,15 @@ bool operator==(const std::string_view&, const std::string_view&);
148144
bool operator==(const std::string_view&, const char*);
149145
bool operator==(const char*, const std::string_view&);
150146

147+
#if __cplusplus < 202002L
148+
bool operator!=(const std::string&, const std::string&);
149+
bool operator!=(const std::string&, const char*);
150+
bool operator!=(const char*, const std::string&);
151+
151152
bool operator!=(const std::string_view&, const std::string_view&);
152153
bool operator!=(const std::string_view&, const char*);
153154
bool operator!=(const char*, const std::string_view&);
155+
#endif
154156

155157
size_t strlen(const char* str);
156158
}

clang-tools-extra/test/clang-tidy/checkers/modernize/use-starts-ends-with.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,3 +320,13 @@ void test_substr() {
320320

321321
str.substr(0, strlen("hello123")) == "hello";
322322
}
323+
324+
void test_operator_rewriting(std::string str, std::string prefix) {
325+
str.substr(0, prefix.size()) == prefix;
326+
// CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: use starts_with instead of substr
327+
// CHECK-FIXES: str.starts_with(prefix);
328+
329+
str.substr(0, prefix.size()) != prefix;
330+
// CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: use starts_with instead of substr
331+
// CHECK-FIXES: !str.starts_with(prefix);
332+
}

clang/docs/ReleaseNotes.rst

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,35 @@ C++ Specific Potentially Breaking Changes
158158

159159
Previously, this code was erroneously accepted.
160160

161+
- Clang will now consider the implicitly deleted destructor of a union or
162+
a non-union class without virtual base class to be ``constexpr`` in C++20
163+
mode (Clang 19 only did so in C++23 mode but the standard specification for
164+
this changed in C++20). (#GH85550)
165+
166+
.. code-block:: c++
167+
168+
struct NonLiteral {
169+
NonLiteral() {}
170+
~NonLiteral() {}
171+
};
172+
173+
template <class T>
174+
struct Opt {
175+
union {
176+
char c;
177+
T data;
178+
};
179+
bool engaged = false;
180+
181+
constexpr Opt() {}
182+
constexpr ~Opt() {
183+
if (engaged)
184+
data.~T();
185+
}
186+
};
187+
188+
// Previously only accepted in C++23 and later, now also accepted in C++20.
189+
consteval void foo() { Opt<NonLiteral>{}; }
161190

162191
ABI Changes in This Version
163192
---------------------------
@@ -725,6 +754,7 @@ Bug Fixes to C++ Support
725754
- Clang now uses valid deduced type locations when diagnosing functions with trailing return type
726755
missing placeholder return type. (#GH78694)
727756
- Fixed a bug where bounds of partially expanded pack indexing expressions were checked too early. (#GH116105)
757+
- Fixed an assertion failure caused by using ``consteval`` in condition in consumed analyses. (#GH117385)
728758

729759
Bug Fixes to AST Handling
730760
^^^^^^^^^^^^^^^^^^^^^^^^^

clang/docs/UsersManual.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2660,7 +2660,7 @@ usual build cycle when using sample profilers for optimization:
26602660
26612661
> clang-cl /O2 -gdwarf -gline-tables-only ^
26622662
/clang:-fdebug-info-for-profiling /clang:-funique-internal-linkage-names ^
2663-
/fprofile-sample-use=code.prof code.cc /Fe:code /fuse-ld=lld /link /debug:dwarf
2663+
/fprofile-sample-use=code.prof code.cc /Fe:code -fuse-ld=lld /link /debug:dwarf
26642664
26652665
[OPTIONAL] Sampling-based profiles can have inaccuracies or missing block/
26662666
edge counters. The profile inference algorithm (profi) can be used to infer
@@ -2679,7 +2679,7 @@ usual build cycle when using sample profilers for optimization:
26792679
26802680
> clang-cl /clang:-fsample-profile-use-profi /O2 -gdwarf -gline-tables-only ^
26812681
/clang:-fdebug-info-for-profiling /clang:-funique-internal-linkage-names ^
2682-
/fprofile-sample-use=code.prof code.cc /Fe:code /fuse-ld=lld /link /debug:dwarf
2682+
/fprofile-sample-use=code.prof code.cc /Fe:code -fuse-ld=lld /link /debug:dwarf
26832683
26842684
Sample Profile Formats
26852685
""""""""""""""""""""""

clang/include/clang/AST/DeclCXX.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -890,6 +890,13 @@ class CXXRecordDecl : public RecordDecl {
890890
needsOverloadResolutionForDestructor()) &&
891891
"destructor should not be deleted");
892892
data().DefaultedDestructorIsDeleted = true;
893+
// C++23 [dcl.constexpr]p3.2:
894+
// if the function is a constructor or destructor, its class does not have
895+
// any virtual base classes.
896+
// C++20 [dcl.constexpr]p5:
897+
// The definition of a constexpr destructor whose function-body is
898+
// not = delete shall additionally satisfy...
899+
data().DefaultedDestructorIsConstexpr = data().NumVBases == 0;
893900
}
894901

895902
/// Determine whether this class should get an implicit move

clang/include/clang/Analysis/FlowSensitive/ASTOps.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,10 @@ struct ReferencedDecls {
146146
/// Free functions and member functions which are referenced (but not
147147
/// necessarily called).
148148
llvm::DenseSet<const FunctionDecl *> Functions;
149+
/// When analyzing a lambda's call operator, the set of all parameters (from
150+
/// the surrounding function) that the lambda captures. Captured local
151+
/// variables are already included in `Locals` above.
152+
llvm::DenseSet<const ParmVarDecl *> LambdaCapturedParams;
149153
};
150154

151155
/// Returns declarations that are declared in or referenced from `FD`.

clang/include/clang/Basic/DiagnosticASTKinds.td

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -782,8 +782,8 @@ def err_module_odr_violation_field : Error<
782782
"%select{"
783783
"field %4|"
784784
"field %4 with type %5|"
785-
"%select{non-|}5bitfield %4|"
786-
"bitfield %4 with one width expression|"
785+
"%select{non-|}5bit-field %4|"
786+
"bit-field %4 with one width expression|"
787787
"%select{non-|}5mutable field %4|"
788788
"field %4 with %select{no|an}5 initializer|"
789789
"field %4 with an initializer"
@@ -793,8 +793,8 @@ def note_module_odr_violation_field : Note<
793793
"%select{"
794794
"field %3|"
795795
"field %3 with type %4|"
796-
"%select{non-|}4bitfield %3|"
797-
"bitfield %3 with different width expression|"
796+
"%select{non-|}4bit-field %3|"
797+
"bit-field %3 with different width expression|"
798798
"%select{non-|}4mutable field %3|"
799799
"field %3 with %select{no|an}4 initializer|"
800800
"field %3 with a different initializer"

0 commit comments

Comments
 (0)