Skip to content

Commit b61cfcc

Browse files
authored
Merge branch 'main' into readability-qualified-auto-opaque-types
2 parents 0931979 + ded1426 commit b61cfcc

File tree

1,187 files changed

+18713
-12799
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,187 files changed

+18713
-12799
lines changed

bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#include "bolt/Core/MCPlusBuilder.h"
2323
#include "llvm/BinaryFormat/ELF.h"
2424
#include "llvm/MC/MCContext.h"
25-
#include "llvm/MC/MCFixupKindInfo.h"
2625
#include "llvm/MC/MCInstBuilder.h"
2726
#include "llvm/MC/MCInstrInfo.h"
2827
#include "llvm/MC/MCRegister.h"
@@ -2557,7 +2556,7 @@ class AArch64MCPlusBuilder : public MCPlusBuilder {
25572556
else if (Fixup.getKind() ==
25582557
MCFixupKind(AArch64::fixup_aarch64_pcrel_branch26))
25592558
RelType = ELF::R_AARCH64_JUMP26;
2560-
else if (FKI.Flags & MCFixupKindInfo::FKF_IsPCRel) {
2559+
else if (Fixup.isPCRel()) {
25612560
switch (FKI.TargetSize) {
25622561
default:
25632562
return std::nullopt;

bolt/lib/Target/X86/X86MCPlusBuilder.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include "bolt/Core/MCPlusBuilder.h"
1919
#include "llvm/BinaryFormat/ELF.h"
2020
#include "llvm/MC/MCContext.h"
21-
#include "llvm/MC/MCFixupKindInfo.h"
2221
#include "llvm/MC/MCInst.h"
2322
#include "llvm/MC/MCInstBuilder.h"
2423
#include "llvm/MC/MCInstrInfo.h"
@@ -2444,7 +2443,7 @@ class X86MCPlusBuilder : public MCPlusBuilder {
24442443
const uint64_t RelOffset = Fixup.getOffset();
24452444

24462445
uint32_t RelType;
2447-
if (FKI.Flags & MCFixupKindInfo::FKF_IsPCRel) {
2446+
if (Fixup.isPCRel()) {
24482447
switch (FKI.TargetSize) {
24492448
default:
24502449
return std::nullopt;

clang-tools-extra/clang-tidy/misc/UnconventionalAssignOperatorCheck.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,11 @@ void UnconventionalAssignOperatorCheck::registerMatchers(
6666
hasArgument(0, cxxThisExpr())),
6767
cxxOperatorCallExpr(
6868
hasOverloadedOperatorName("="),
69-
hasArgument(
70-
0, unaryOperator(hasOperatorName("*"),
69+
hasArgument(0, unaryOperator(hasOperatorName("*"),
70+
hasUnaryOperand(cxxThisExpr())))),
71+
binaryOperator(
72+
hasOperatorName("="),
73+
hasLHS(unaryOperator(hasOperatorName("*"),
7174
hasUnaryOperand(cxxThisExpr())))))))));
7275
const auto IsGoodAssign = cxxMethodDecl(IsAssign, HasGoodReturnType);
7376

clang-tools-extra/clangd/InlayHints.cpp

Lines changed: 2 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
#include "llvm/ADT/StringExtras.h"
3434
#include "llvm/ADT/StringRef.h"
3535
#include "llvm/ADT/Twine.h"
36-
#include "llvm/ADT/identity.h"
3736
#include "llvm/Support/Casting.h"
3837
#include "llvm/Support/ErrorHandling.h"
3938
#include "llvm/Support/FormatVariadic.h"
@@ -339,53 +338,6 @@ QualType maybeDesugar(ASTContext &AST, QualType QT) {
339338
return QT;
340339
}
341340

342-
// Given a callee expression `Fn`, if the call is through a function pointer,
343-
// try to find the declaration of the corresponding function pointer type,
344-
// so that we can recover argument names from it.
345-
// FIXME: This function is mostly duplicated in SemaCodeComplete.cpp; unify.
346-
static FunctionProtoTypeLoc getPrototypeLoc(Expr *Fn) {
347-
TypeLoc Target;
348-
Expr *NakedFn = Fn->IgnoreParenCasts();
349-
if (const auto *T = NakedFn->getType().getTypePtr()->getAs<TypedefType>()) {
350-
Target = T->getDecl()->getTypeSourceInfo()->getTypeLoc();
351-
} else if (const auto *DR = dyn_cast<DeclRefExpr>(NakedFn)) {
352-
const auto *D = DR->getDecl();
353-
if (const auto *const VD = dyn_cast<VarDecl>(D)) {
354-
Target = VD->getTypeSourceInfo()->getTypeLoc();
355-
}
356-
}
357-
358-
if (!Target)
359-
return {};
360-
361-
// Unwrap types that may be wrapping the function type
362-
while (true) {
363-
if (auto P = Target.getAs<PointerTypeLoc>()) {
364-
Target = P.getPointeeLoc();
365-
continue;
366-
}
367-
if (auto A = Target.getAs<AttributedTypeLoc>()) {
368-
Target = A.getModifiedLoc();
369-
continue;
370-
}
371-
if (auto P = Target.getAs<ParenTypeLoc>()) {
372-
Target = P.getInnerLoc();
373-
continue;
374-
}
375-
break;
376-
}
377-
378-
if (auto F = Target.getAs<FunctionProtoTypeLoc>()) {
379-
// In some edge cases the AST can contain a "trivial" FunctionProtoTypeLoc
380-
// which has null parameters. Avoid these as they don't contain useful
381-
// information.
382-
if (llvm::all_of(F.getParams(), llvm::identity<ParmVarDecl *>()))
383-
return F;
384-
}
385-
386-
return {};
387-
}
388-
389341
ArrayRef<const ParmVarDecl *>
390342
maybeDropCxxExplicitObjectParameters(ArrayRef<const ParmVarDecl *> Params) {
391343
if (!Params.empty() && Params.front()->isExplicitObjectParameter())
@@ -514,7 +466,8 @@ class InlayHintVisitor : public RecursiveASTVisitor<InlayHintVisitor> {
514466
Callee.Decl = FD;
515467
else if (const auto *FTD = dyn_cast<FunctionTemplateDecl>(CalleeDecls[0]))
516468
Callee.Decl = FTD->getTemplatedDecl();
517-
else if (FunctionProtoTypeLoc Loc = getPrototypeLoc(E->getCallee()))
469+
else if (FunctionProtoTypeLoc Loc =
470+
Resolver->getFunctionProtoTypeLoc(E->getCallee()))
518471
Callee.Loc = Loc;
519472
else
520473
return true;

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,11 @@ Changes in existing checks
266266
<clang-tidy/checks/misc/redundant-expression>` check by providing additional
267267
examples and fixing some macro related false positives.
268268

269+
- Improved :doc:`misc-unconventional-assign-operator
270+
<clang-tidy/checks/misc/unconventional-assign-operator>` check by fixing
271+
false positives when copy assignment operator function in a template class
272+
returns the result of another assignment to ``*this`` (``return *this=...``).
273+
269274
- Improved :doc:`misc-unused-using-decls
270275
<clang-tidy/checks/misc/unused-using-decls>` check by fixing false positives
271276
on ``operator""`` with template parameters.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
:orphan:
22
:template: clangd_redirect.html
3-
:redirect_target: https://clangd.llvm.org/design.html
3+
:redirect_target: https://clangd.llvm.org/design/

clang-tools-extra/test/clang-tidy/checkers/misc/unconventional-assign-operator.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,3 +163,16 @@ struct TemplateTypeAlias {
163163
Alias3<TypeAlias::Alias> &operator=(double) { return *this; }
164164
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: operator=() should return 'TemplateTypeAlias&' [misc-unconventional-assign-operator]
165165
};
166+
167+
namespace gh143237 {
168+
template<typename T>
169+
struct TemplateAssignment {
170+
explicit TemplateAssignment(int) {
171+
}
172+
173+
TemplateAssignment& operator=(int n) {
174+
// No warning
175+
return *this = TemplateAssignment(n);
176+
}
177+
};
178+
}

clang/docs/DebuggingCoroutines.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ suspension point.
221221
Line 45 of "llvm-example.cpp" starts at address 0x201b <_ZL9coro_taski.destroy+555> and ends at 0x2046 <_ZL9coro_taski.destroy+598>.
222222
Line 45 of "llvm-example.cpp" starts at address 0x253b <_ZL9coro_taski.cleanup+555> and ends at 0x2566 <_ZL9coro_taski.cleanup+598>.
223223

224-
LLDB does not support looking up labels. Furthmore, those labels are only emitted
224+
LLDB does not support looking up labels. Furthermore, those labels are only emitted
225225
starting with clang 21.0.
226226

227227
For simple cases, you might still be able to guess the suspension point correctly.

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -899,6 +899,8 @@ Bug Fixes to C++ Support
899899
- Fixed a crash when constant evaluating some explicit object member assignment operators. (#GH142835)
900900
- Fixed an access checking bug when substituting into concepts (#GH115838)
901901
- Fix a bug where private access specifier of overloaded function not respected. (#GH107629)
902+
- Correctly handle allocations in the condition of a ``if constexpr``.(#GH120197) (#GH134820)
903+
- Fixed a crash when handling invalid member using-declaration in C++20+ mode. (#GH63254)
902904

903905
Bug Fixes to AST Handling
904906
^^^^^^^^^^^^^^^^^^^^^^^^^

clang/include/clang/ASTMatchers/ASTMatchers.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6519,11 +6519,11 @@ AST_POLYMORPHIC_MATCHER(
65196519
/// Given
65206520
/// \code
65216521
/// void a(int);
6522-
/// void b(long);
6522+
/// void b(unsigned long);
65236523
/// void c(double);
65246524
/// \endcode
65256525
/// functionDecl(hasAnyParameter(hasType(isInteger())))
6526-
/// matches "a(int)", "b(long)", but not "c(double)".
6526+
/// matches "a(int)", "b(unsigned long)", but not "c(double)".
65276527
AST_MATCHER(QualType, isInteger) {
65286528
return Node->isIntegerType();
65296529
}

0 commit comments

Comments
 (0)