Skip to content

Commit 840a968

Browse files
[clang-tools-extra] Use range-based for loops (NFC)
1 parent 384b815 commit 840a968

File tree

4 files changed

+9
-10
lines changed

4 files changed

+9
-10
lines changed

clang-tools-extra/clangd/CompileCommands.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -290,10 +290,10 @@ void CommandMangler::operator()(tooling::CompileCommand &Command,
290290
Cmd.resize(DashDashIndex);
291291
}
292292
llvm::sort(IndicesToDrop);
293-
llvm::for_each(llvm::reverse(IndicesToDrop),
294-
// +1 to account for the executable name in Cmd[0] that
295-
// doesn't exist in ArgList.
296-
[&Cmd](unsigned Idx) { Cmd.erase(Cmd.begin() + Idx + 1); });
293+
for (unsigned Idx : llvm::reverse(IndicesToDrop))
294+
// +1 to account for the executable name in Cmd[0] that
295+
// doesn't exist in ArgList.
296+
Cmd.erase(Cmd.begin() + Idx + 1);
297297
// All the inputs are stripped, append the name for the requested file. Rest
298298
// of the modifications should respect `--`.
299299
Cmd.push_back("--");

clang-tools-extra/clangd/ParsedAST.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,8 +425,8 @@ ParsedAST::build(llvm::StringRef Filename, const ParseInputs &Inputs,
425425
StoreDiags ASTDiags;
426426
ASTDiags.setDiagCallback(
427427
[&ASTListeners](const clang::Diagnostic &D, clangd::Diag &Diag) {
428-
llvm::for_each(ASTListeners,
429-
[&](const auto &L) { L->sawDiagnostic(D, Diag); });
428+
for (const auto &L : ASTListeners)
429+
L->sawDiagnostic(D, Diag);
430430
});
431431

432432
std::optional<PreamblePatch> Patch;

clang-tools-extra/clangd/Preamble.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -610,8 +610,8 @@ buildPreamble(PathRef FileName, CompilerInvocation CI,
610610
StoreDiags PreambleDiagnostics;
611611
PreambleDiagnostics.setDiagCallback(
612612
[&ASTListeners](const clang::Diagnostic &D, clangd::Diag &Diag) {
613-
llvm::for_each(ASTListeners,
614-
[&](const auto &L) { L->sawDiagnostic(D, Diag); });
613+
for (const auto &L : ASTListeners)
614+
L->sawDiagnostic(D, Diag);
615615
});
616616
llvm::IntrusiveRefCntPtr<DiagnosticsEngine> PreambleDiagsEngine =
617617
CompilerInstance::createDiagnostics(&CI.getDiagnosticOpts(),

clang-tools-extra/include-cleaner/lib/WalkAST.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,8 @@ class ASTWalker : public RecursiveASTVisitor<ASTWalker> {
173173

174174
bool VisitOverloadExpr(OverloadExpr *E) {
175175
// Since we can't prove which overloads are used, report all of them.
176-
llvm::for_each(E->decls(), [this, E](NamedDecl *D) {
176+
for (NamedDecl *D : E->decls())
177177
report(E->getNameLoc(), D, RefType::Ambiguous);
178-
});
179178
return true;
180179
}
181180

0 commit comments

Comments
 (0)