Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
d05370e
[clang-tidy][NFC] Enable readability-any-all-of check (#167134)
vbvictor Dec 3, 2025
73036cf
[clang-tidy][NFC] Fix miscellaneous clang-tidy warnings (#170424)
vbvictor Dec 3, 2025
689b3cc
[clang] Support header shadowing diagnostics in Clang header search (…
Jinjie-Huang Dec 3, 2025
9f634c6
[RISCV][GISel] Fix legalize G_EXTRACT_SUBVECTOR (#169877)
jacquesguan Dec 3, 2025
042a38f
[Support] Optimize DebugCounter (#170305)
nikic Dec 3, 2025
30f479f
[CIR] Use default attribute printer/parser (NFC) (#170366)
xlauko Dec 3, 2025
e6110cb
[mlir][Transforms] Fix crash in `-remove-dead-values` on private func…
matthias-springer Dec 3, 2025
98182f4
Move CodeGenFunction::EmitScalarOrConstFoldImmArg; NFC (#170286)
svenvh Dec 3, 2025
5ee6cff
[clang] Propagate definition data to all redecls (#170090)
hahnjo Dec 3, 2025
befa4e8
[AMDGPU] Avoid undefs in hazard-gfx1250-flat-scr-hi.mir. NFC (#170396)
rampitec Dec 3, 2025
ae4289f
[Hexagon][NFC] Drop no-op getMaskedMemoryOpCost/getGatherScatterOpCos…
arcbbb Dec 3, 2025
cd86b2a
[CodeGen] Add MO_LaneMask type and a new COPY_LANEMASK instruction (#…
vg0204 Dec 3, 2025
c5ecdec
[lldb-dap] start all sent protocol message from number one. (#170378)
da-viper Dec 3, 2025
6638d59
[lldb][NFC] Rename forward_branch_offset to branch_offset in UnwindAs…
felipepiovezan Dec 3, 2025
4b0a975
[OpenCL][NVPTX] Don't set calling convention for OpenCL kernel (#170170)
XChy Dec 3, 2025
8b7a07a
[lldb] Fix abi_tag parsing for operator<< and operator-named tags (#…
da-viper Dec 3, 2025
7cdb27a
[NFC][AMDGPU] Refactor wave reduce test files (#170440)
easyonaadit Dec 3, 2025
2b725ab
[lldb] Add DisassemblerLLVMC::IsBarrier API (#169632)
felipepiovezan Dec 3, 2025
9296223
[clang-tidy] Fix `cppcoreguidelines-pro-type-member-init` check (#169…
zeyi2 Dec 3, 2025
114ca65
[TTI] Use MemIntrinsicCostAttributes for getStridedOpCost (#170436)
arcbbb Dec 3, 2025
5ccf8c9
[flang] implement VECTOR VECTORLENGTH directive (#170114)
tblah Dec 3, 2025
8feb676
[AMDGPU] Take BUF instructions into account in mayAccessScratchThroug…
Pierre-vh Dec 3, 2025
2697c8c
[LowerMemIntrinsics] Factor control flow generation out of the memcpy…
ritter-x2a Dec 3, 2025
f17abc2
[mlir][emitc] Add address-of and dereference ops (#72569)
aniragil Dec 3, 2025
4977444
[clang-tidy] Fix false positive in `readability-redundant-typename` (…
zeyi2 Dec 3, 2025
4e4763a
[lldb] Handle backwards branches in UnwindAssemblyInstEmulation (#169…
felipepiovezan Dec 3, 2025
bfde296
[lldb/docs] Add ScriptingFrameProvider documentation to the website
medismailben Dec 3, 2025
c0f0936
[lldb] Fix ThreadPlanStepOut::DoPlanExplainsStop inspection of Breakp…
felipepiovezan Dec 3, 2025
aeb36a9
[ORC] Port CallableTraitsHelper from the new ORC runtime. (#170441)
lhames Dec 3, 2025
6822e3c
[VectorCombine][X86] Add tests showing failure to push a shuffle thro…
RKSimon Dec 3, 2025
1ca763b
[llvm-readobj] [ARMWinEH] Fix printing of packed unwind with H=1, Reg…
mstorsjo Dec 3, 2025
4286a47
Revert "[lldb/docs] Add ScriptingFrameProvider documentation to the w…
medismailben Dec 3, 2025
0dcbc87
[lldb/docs] Add ScriptingFrameProvider documentation to the website
medismailben Dec 3, 2025
dd9a516
[gn build] Port aeb36a925234
llvmgnsyncbot Dec 3, 2025
4497c53
[clang][bytecode] Accept current PC argument in Function::dump() (#17…
tbaederr Dec 3, 2025
d68f543
[clang-tidy] Remove 'clang-analyzer-*' checks from default checks. (#…
vbvictor Dec 3, 2025
38c7495
merge main into amd-staging
ronlieb Dec 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions clang-tools-extra/clang-tidy/.clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ Checks: >
-readability-qualified-auto,
-readability-simplify-boolean-expr,
-readability-static-definition-in-anonymous-namespace,
-readability-suspicious-call-argument,
-readability-use-anyofallof
-readability-suspicious-call-argument
CheckOptions:
- key: performance-move-const-arg.CheckTriviallyCopyableMove
Expand Down
9 changes: 4 additions & 5 deletions clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -478,11 +478,10 @@ bool ClangTidyDiagnosticConsumer::passesLineFilter(StringRef FileName,
if (FileName.ends_with(Filter.Name)) {
if (Filter.LineRanges.empty())
return true;
for (const FileFilter::LineRange &Range : Filter.LineRanges) {
if (Range.first <= LineNumber && LineNumber <= Range.second)
return true;
}
return false;
return llvm::any_of(
Filter.LineRanges, [&](const FileFilter::LineRange &Range) {
return Range.first <= LineNumber && LineNumber <= Range.second;
});
}
}
return false;
Expand Down
9 changes: 3 additions & 6 deletions clang-tools-extra/clang-tidy/bugprone/BranchCloneCheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,9 @@ static bool isFallthroughSwitchBranch(const SwitchBranch &Branch) {
if (!S)
return true;

for (const Attr *A : S->getAttrs()) {
if (isa<FallThroughAttr>(A))
return false;
}

return true;
return llvm::all_of(S->getAttrs(), [](const Attr *A) {
return !isa<FallThroughAttr>(A);
});
}
} Visitor;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,17 @@ AST_MATCHER(CXXRecordDecl, correctHandleCaptureThisLambda) {
if (Node.hasSimpleMoveAssignment())
return false;

for (const CXXConstructorDecl *C : Node.ctors()) {
if (C->isCopyOrMoveConstructor() && C->isDefaulted() && !C->isDeleted())
return false;
}
for (const CXXMethodDecl *M : Node.methods()) {
if (M->isCopyAssignmentOperator())
llvm::errs() << M->isDeleted() << "\n";
if (M->isCopyAssignmentOperator() && M->isDefaulted() && !M->isDeleted())
return false;
if (M->isMoveAssignmentOperator() && M->isDefaulted() && !M->isDeleted())
return false;
}
if (llvm::any_of(Node.ctors(), [](const CXXConstructorDecl *C) {
return C->isCopyOrMoveConstructor() && C->isDefaulted() &&
!C->isDeleted();
}))
return false;
if (llvm::any_of(Node.methods(), [](const CXXMethodDecl *M) {
return (M->isCopyAssignmentOperator() ||
M->isMoveAssignmentOperator()) &&
M->isDefaulted() && !M->isDeleted();
}))
return false;
// FIXME: find ways to identifier correct handle capture this lambda
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1589,11 +1589,9 @@ static bool lazyMapOfSetsIntersectionExists(const MapTy &Map, const ElemTy &E1,
if (E1Iterator == Map.end() || E2Iterator == Map.end())
return false;

for (const auto &E1SetElem : E1Iterator->second)
if (E2Iterator->second.contains(E1SetElem))
return true;

return false;
return llvm::any_of(E1Iterator->second, [&E2Iterator](const auto &E1SetElem) {
return E2Iterator->second.contains(E1SetElem);
});
}

/// Implements the heuristic that marks two parameters related if there is
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ void ExceptionEscapeCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {

void ExceptionEscapeCheck::registerMatchers(MatchFinder *Finder) {
auto MatchIf = [](bool Enabled, const auto &Matcher) {
ast_matchers::internal::Matcher<FunctionDecl> Nothing = unless(anything());
const ast_matchers::internal::Matcher<FunctionDecl> Nothing =
unless(anything());
return Enabled ? Matcher : Nothing;
};
Finder->addMatcher(
Expand Down
18 changes: 6 additions & 12 deletions clang-tools-extra/clang-tidy/bugprone/InfiniteLoopCheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,9 @@ static bool isAtLeastOneCondVarChanged(const Decl *Func, const Stmt *LoopStmt,
if (isVarThatIsPossiblyChanged(Func, LoopStmt, Cond, Context))
return true;

for (const Stmt *Child : Cond->children()) {
if (!Child)
continue;

if (isAtLeastOneCondVarChanged(Func, LoopStmt, Child, Context))
return true;
}
return false;
return llvm::any_of(Cond->children(), [&](const Stmt *Child) {
return Child && isAtLeastOneCondVarChanged(Func, LoopStmt, Child, Context);
});
}

/// Return the variable names in `Cond`.
Expand Down Expand Up @@ -240,10 +235,9 @@ static bool hasStaticLocalVariable(const Stmt *Cond) {
return true;
}

for (const Stmt *Child : Cond->children())
if (Child && hasStaticLocalVariable(Child))
return true;
return false;
return llvm::any_of(Cond->children(), [](const Stmt *Child) {
return Child && hasStaticLocalVariable(Child);
});
}

/// Tests if the loop condition `Cond` involves static local variables and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,9 @@ class FindAssignToVarBefore
return false;
}
bool VisitStmt(const Stmt *S) {
for (const Stmt *Child : S->children())
if (Child && Visit(Child))
return true;
return false;
return llvm::any_of(S->children(), [this](const Stmt *Child) {
return Child && Visit(Child);
});
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ namespace clang::tidy::cppcoreguidelines {
namespace {
AST_MATCHER_P(CXXForRangeStmt, hasRangeBeginEndStmt,
ast_matchers::internal::Matcher<DeclStmt>, InnerMatcher) {
for (const DeclStmt *Stmt : {Node.getBeginStmt(), Node.getEndStmt()})
if (Stmt != nullptr && InnerMatcher.matches(*Stmt, Finder, Builder))
return true;
return false;
return llvm::any_of(llvm::ArrayRef{Node.getBeginStmt(), Node.getEndStmt()},
[&](const DeclStmt *Stmt) {
return Stmt &&
InnerMatcher.matches(*Stmt, Finder, Builder);
});
}

AST_MATCHER(Stmt, isInsideOfRangeBeginEndStmt) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,8 @@ void ProTypeMemberInitCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
}

// FIXME: Copied from clang/lib/Sema/SemaDeclCXX.cpp.
static bool isIncompleteOrZeroLengthArrayType(ASTContext &Context, QualType T) {
static bool isIncompleteOrZeroLengthArrayType(const ASTContext &Context,
QualType T) {
if (T->isIncompleteArrayType())
return true;

Expand All @@ -375,7 +376,7 @@ static bool isIncompleteOrZeroLengthArrayType(ASTContext &Context, QualType T) {
return false;
}

static bool isEmpty(ASTContext &Context, const QualType &Type) {
static bool isEmpty(const ASTContext &Context, const QualType &Type) {
if (const CXXRecordDecl *ClassDecl = Type->getAsCXXRecordDecl()) {
return ClassDecl->isEmpty();
}
Expand Down Expand Up @@ -431,19 +432,13 @@ static llvm::StringLiteral getInitializer(QualType QT, bool UseAssignment) {
}
}

void ProTypeMemberInitCheck::checkMissingMemberInitializer(
ASTContext &Context, const CXXRecordDecl &ClassDecl,
const CXXConstructorDecl *Ctor) {
const bool IsUnion = ClassDecl.isUnion();

if (IsUnion && ClassDecl.hasInClassInitializer())
return;

// Gather all fields (direct and indirect) that need to be initialized.
SmallPtrSet<const FieldDecl *, 16> FieldsToInit;
static void
computeFieldsToInit(const ASTContext &Context, const RecordDecl &Record,
bool IgnoreArrays,
SmallPtrSetImpl<const FieldDecl *> &FieldsToInit) {
bool AnyMemberHasInitPerUnion = false;
forEachFieldWithFilter(
ClassDecl, ClassDecl.fields(), AnyMemberHasInitPerUnion,
Record, Record.fields(), AnyMemberHasInitPerUnion,
[&](const FieldDecl *F) {
if (IgnoreArrays && F->getType()->isArrayType())
return;
Expand All @@ -458,6 +453,19 @@ void ProTypeMemberInitCheck::checkMissingMemberInitializer(
!AnyMemberHasInitPerUnion)
FieldsToInit.insert(F);
});
}

void ProTypeMemberInitCheck::checkMissingMemberInitializer(
ASTContext &Context, const CXXRecordDecl &ClassDecl,
const CXXConstructorDecl *Ctor) {
const bool IsUnion = ClassDecl.isUnion();

if (IsUnion && ClassDecl.hasInClassInitializer())
return;

// Gather all fields (direct and indirect) that need to be initialized.
SmallPtrSet<const FieldDecl *, 16> FieldsToInit;
computeFieldsToInit(Context, ClassDecl, IgnoreArrays, FieldsToInit);
if (FieldsToInit.empty())
return;

Expand Down Expand Up @@ -507,7 +515,7 @@ void ProTypeMemberInitCheck::checkMissingMemberInitializer(
// Collect all fields but only suggest a fix for the first member of unions,
// as initializing more than one union member is an error.
SmallPtrSet<const FieldDecl *, 16> FieldsToFix;
AnyMemberHasInitPerUnion = false;
bool AnyMemberHasInitPerUnion = false;
forEachFieldWithFilter(ClassDecl, ClassDecl.fields(),
AnyMemberHasInitPerUnion, [&](const FieldDecl *F) {
if (!FieldsToInit.contains(F))
Expand Down Expand Up @@ -582,6 +590,17 @@ void ProTypeMemberInitCheck::checkMissingBaseClassInitializer(

void ProTypeMemberInitCheck::checkUninitializedTrivialType(
const ASTContext &Context, const VarDecl *Var) {
// Verify that the record actually needs initialization
const CXXRecordDecl *Record = Var->getType()->getAsCXXRecordDecl();
if (!Record)
return;

SmallPtrSet<const FieldDecl *, 16> FieldsToInit;
computeFieldsToInit(Context, *Record, IgnoreArrays, FieldsToInit);

if (FieldsToInit.empty())
return;

const DiagnosticBuilder Diag =
diag(Var->getBeginLoc(), "uninitialized record type: %0") << Var;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@ AST_MATCHER(CXXRecordDecl, hasDirectVirtualBaseClass) {
return false;
if (!Node.getNumVBases())
return false;
for (const CXXBaseSpecifier &Base : Node.bases())
if (Base.isVirtual())
return true;
return false;
return llvm::any_of(Node.bases(), [](const CXXBaseSpecifier &Base) {
return Base.isVirtual();
});
}
} // namespace

Expand Down
12 changes: 5 additions & 7 deletions clang-tools-extra/clang-tidy/misc/NewDeleteOverloadsCheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,15 @@ hasCorrespondingOverloadInBaseClass(const CXXMethodDecl *MD,
RD = MD->getParent();
}

for (const auto &BS : RD->bases()) {
return llvm::any_of(RD->bases(), [&](const CXXBaseSpecifier &BS) {
// We can't say much about a dependent base class, but to avoid false
// positives assume it can have a corresponding overload.
if (BS.getType()->isDependentType())
return true;
if (const auto *BaseRD = BS.getType()->getAsCXXRecordDecl())
if (hasCorrespondingOverloadInBaseClass(MD, BaseRD))
return true;
}

return false;
if (const CXXRecordDecl *BaseRD = BS.getType()->getAsCXXRecordDecl())
return hasCorrespondingOverloadInBaseClass(MD, BaseRD);
return false;
});
}

void NewDeleteOverloadsCheck::registerMatchers(MatchFinder *Finder) {
Expand Down
11 changes: 4 additions & 7 deletions clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,10 @@ static bool isOverrideMethod(const FunctionDecl *Function) {

static bool hasAttrAfterParam(const SourceManager *SourceManager,
const ParmVarDecl *Param) {
for (const auto *Attr : Param->attrs()) {
if (SourceManager->isBeforeInTranslationUnit(Param->getLocation(),
Attr->getLocation())) {
return true;
}
}
return false;
return llvm::any_of(Param->attrs(), [&](const Attr *Attr) {
return SourceManager->isBeforeInTranslationUnit(Param->getLocation(),
Attr->getLocation());
});
}

void UnusedParametersCheck::registerMatchers(MatchFinder *Finder) {
Expand Down
19 changes: 8 additions & 11 deletions clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -510,27 +510,24 @@ static bool canBeModified(ASTContext *Context, const Expr *E) {
/// Returns true when it can be guaranteed that the elements of the
/// container are not being modified.
static bool usagesAreConst(ASTContext *Context, const UsageResult &Usages) {
for (const Usage &U : Usages) {
return llvm::none_of(Usages, [&Context](const Usage &U) {
// Lambda captures are just redeclarations (VarDecl) of the same variable,
// not expressions. If we want to know if a variable that is captured by
// reference can be modified in an usage inside the lambda's body, we need
// to find the expression corresponding to that particular usage, later in
// this loop.
if (U.Kind != Usage::UK_CaptureByCopy && U.Kind != Usage::UK_CaptureByRef &&
canBeModified(Context, U.Expression))
return false;
}
return true;
return U.Kind != Usage::UK_CaptureByCopy &&
U.Kind != Usage::UK_CaptureByRef &&
canBeModified(Context, U.Expression);
});
}

/// Returns true if the elements of the container are never accessed
/// by reference.
static bool usagesReturnRValues(const UsageResult &Usages) {
for (const auto &U : Usages) {
if (U.Expression && !U.Expression->isPRValue())
return false;
}
return true;
return llvm::all_of(Usages, [](const Usage &U) {
return !U.Expression || U.Expression->isPRValue();
});
}

/// Returns true if the container is const-qualified.
Expand Down
19 changes: 7 additions & 12 deletions clang-tools-extra/clang-tidy/modernize/LoopConvertUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,11 @@ bool DependencyFinderASTVisitor::VisitVarDecl(VarDecl *V) {

// Next, check if the variable was removed from existence by an earlier
// iteration.
for (const auto &I : *ReplacedVars) {
if (I.second == V) {
DependsOnInsideVariable = true;
return false;
}
}
return true;
if (llvm::none_of(*ReplacedVars,
[&](const auto &I) { return I.second == V; }))
return true;
DependsOnInsideVariable = true;
return false;
}

/// If we already created a variable for TheLoop, check to make sure
Expand Down Expand Up @@ -234,11 +232,8 @@ static bool containsExpr(ASTContext *Context, const ContainerT *Container,
const Expr *E) {
llvm::FoldingSetNodeID ID;
E->Profile(ID, *Context, true);
for (const auto &I : *Container) {
if (ID == I.second)
return true;
}
return false;
return llvm::any_of(*Container,
[&](const auto &I) { return ID == I.second; });
}

/// Returns true when the index expression is a declaration reference to
Expand Down
6 changes: 1 addition & 5 deletions clang-tools-extra/clang-tidy/modernize/PassByValueCheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,7 @@ static bool hasRValueOverload(const CXXConstructorDecl *Ctor,
return true;
};

for (const auto *Candidate : Record->ctors()) {
if (IsRValueOverload(Candidate))
return true;
}
return false;
return llvm::any_of(Record->ctors(), IsRValueOverload);
}

/// Find all references to \p ParamDecl across all of the
Expand Down
Loading