aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-tapi-diff
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2023-02-11 12:38:04 +0000
committerDimitry Andric <dim@FreeBSD.org>2023-02-11 12:38:11 +0000
commite3b557809604d036af6e00c60f012c2025b59a5e (patch)
tree8a11ba2269a3b669601e2fd41145b174008f4da8 /llvm/tools/llvm-tapi-diff
parent08e8dd7b9db7bb4a9de26d44c1cbfd24e869c014 (diff)
Diffstat (limited to 'llvm/tools/llvm-tapi-diff')
-rw-r--r--llvm/tools/llvm-tapi-diff/DiffEngine.cpp20
-rw-r--r--llvm/tools/llvm-tapi-diff/DiffEngine.h1
2 files changed, 9 insertions, 12 deletions
diff --git a/llvm/tools/llvm-tapi-diff/DiffEngine.cpp b/llvm/tools/llvm-tapi-diff/DiffEngine.cpp
index 45a1f78525a7..9ebaadbeec26 100644
--- a/llvm/tools/llvm-tapi-diff/DiffEngine.cpp
+++ b/llvm/tools/llvm-tapi-diff/DiffEngine.cpp
@@ -235,12 +235,11 @@ void findAndAddDiff(const std::vector<InterfaceFileRef> &CollectedIRefVec,
Result.Kind = AD_Str_Vec;
for (const auto &IRef : CollectedIRefVec)
for (auto Targ : IRef.targets()) {
- auto FoundIRef = llvm::find_if(LookupIRefVec, [&](const auto LIRef) {
- auto FoundTarg = llvm::find(LIRef.targets(), Targ);
- return (FoundTarg != LIRef.targets().end() &&
- IRef.getInstallName() == LIRef.getInstallName());
+ auto FoundIRef = llvm::any_of(LookupIRefVec, [&](const auto LIRef) {
+ return llvm::is_contained(LIRef.targets(), Targ) &&
+ IRef.getInstallName() == LIRef.getInstallName();
});
- if (FoundIRef == LookupIRefVec.end())
+ if (!FoundIRef)
addDiffForTargSlice<DiffStrVec,
DiffScalarVal<StringRef, AD_Diff_Scalar_Str>>(
IRef.getInstallName(), Targ, Result, Order);
@@ -267,14 +266,13 @@ void findAndAddDiff(InterfaceFile::const_symbol_range CollectedSyms,
Result.Kind = AD_Sym_Vec;
for (const auto *Sym : CollectedSyms)
for (const auto Targ : Sym->targets()) {
- auto FoundSym = llvm::find_if(LookupSyms, [&](const auto LSym) {
- auto FoundTarg = llvm::find(LSym->targets(), Targ);
+ auto FoundSym = llvm::any_of(LookupSyms, [&](const auto LSym) {
return (Sym->getName() == LSym->getName() &&
Sym->getKind() == LSym->getKind() &&
Sym->getFlags() == LSym->getFlags() &&
- FoundTarg != LSym->targets().end());
+ llvm::is_contained(LSym->targets(), Targ));
});
- if (FoundSym == LookupSyms.end())
+ if (!FoundSym)
addDiffForTargSlice<DiffSymVec, SymScalar>(Sym, Targ, Result, Order);
}
}
@@ -410,10 +408,10 @@ DiffEngine::findDifferences(const InterfaceFile *IFLHS,
}
for (auto DocRHS : IFRHS->documents()) {
auto WasGathered =
- llvm::find_if(DocsInserted, [&](const auto &GatheredDoc) {
+ llvm::any_of(DocsInserted, [&](const auto &GatheredDoc) {
return (GatheredDoc == DocRHS->getInstallName());
});
- if (WasGathered == DocsInserted.end())
+ if (!WasGathered)
Docs.Values.push_back(std::make_unique<InlineDoc>(InlineDoc(
DocRHS->getInstallName(), getSingleIF(DocRHS.get(), rhs))));
}
diff --git a/llvm/tools/llvm-tapi-diff/DiffEngine.h b/llvm/tools/llvm-tapi-diff/DiffEngine.h
index 252fbd87c637..e4864054fa11 100644
--- a/llvm/tools/llvm-tapi-diff/DiffEngine.h
+++ b/llvm/tools/llvm-tapi-diff/DiffEngine.h
@@ -13,7 +13,6 @@
#ifndef LLVM_TOOLS_LLVM_TAPI_DIFF_DIFFENGINE_H
#define LLVM_TOOLS_LLVM_TAPI_DIFF_DIFFENGINE_H
-#include "llvm/ADT/Optional.h"
#include "llvm/Object/TapiUniversal.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/TextAPI/Symbol.h"