[clang] [StaticAnalyzer] Use llvm::find_if (NFC) (PR #169237)
Kazu Hirata via cfe-commits
cfe-commits at lists.llvm.org
Sun Nov 23 12:51:15 PST 2025
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/169237
Identified with llvm-use-ranges.
>From f071e37fdb800c58f4fe3e1b963284983ea3770f Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sun, 23 Nov 2025 11:52:51 -0800
Subject: [PATCH] [StaticAnalyzer] Use llvm::find_if (NFC)
Identified with llvm-use-ranges.
---
clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp b/clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp
index 6673f2f319c0e..aafd8d45537e3 100644
--- a/clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp
+++ b/clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp
@@ -202,11 +202,10 @@ SarifDiagnostics::createResult(const PathDiagnostic *Diag,
// Find the HTML report that was generated for this issue, if one exists.
PDFileEntry::ConsumerFiles *Files = FM->getFiles(*Diag);
if (Files) {
- auto HtmlFile =
- std::find_if(Files->cbegin(), Files->cend(), [](auto &File) {
- return File.first == HTML_DIAGNOSTICS_NAME;
- });
- if (HtmlFile != Files->cend()) {
+ auto HtmlFile = llvm::find_if(*Files, [](const auto &File) {
+ return File.first == HTML_DIAGNOSTICS_NAME;
+ });
+ if (HtmlFile != Files->end()) {
SmallString<128> HtmlReportPath =
llvm::sys::path::parent_path(OutputFile);
llvm::sys::path::append(HtmlReportPath, HtmlFile->second);
More information about the cfe-commits
mailing list