mirror of
https://github.com/intel/llvm.git
synced 2026-02-06 06:31:50 +08:00
Use llvm::is_contained (NFC)
This commit is contained in:
@@ -1512,12 +1512,10 @@ static bool isIgnoredParameter(const TheCheck &Check, const ParmVarDecl *Node) {
|
||||
<< "' is ignored.\n");
|
||||
|
||||
if (!Node->getIdentifier())
|
||||
return llvm::find(Check.IgnoredParameterNames, "\"\"") !=
|
||||
Check.IgnoredParameterNames.end();
|
||||
return llvm::is_contained(Check.IgnoredParameterNames, "\"\"");
|
||||
|
||||
StringRef NodeName = Node->getName();
|
||||
if (llvm::find(Check.IgnoredParameterNames, NodeName) !=
|
||||
Check.IgnoredParameterNames.end()) {
|
||||
if (llvm::is_contained(Check.IgnoredParameterNames, NodeName)) {
|
||||
LLVM_DEBUG(llvm::dbgs() << "\tName ignored.\n");
|
||||
return true;
|
||||
}
|
||||
@@ -1584,7 +1582,7 @@ bool lazyMapOfSetsIntersectionExists(const MapTy &Map, const ElemTy &E1,
|
||||
return false;
|
||||
|
||||
for (const auto &E1SetElem : E1Iterator->second)
|
||||
if (llvm::find(E2Iterator->second, E1SetElem) != E2Iterator->second.end())
|
||||
if (llvm::is_contained(E2Iterator->second, E1SetElem))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -1746,8 +1744,8 @@ public:
|
||||
}
|
||||
|
||||
bool operator()(const ParmVarDecl *Param1, const ParmVarDecl *Param2) const {
|
||||
return llvm::find(ReturnedParams, Param1) != ReturnedParams.end() &&
|
||||
llvm::find(ReturnedParams, Param2) != ReturnedParams.end();
|
||||
return llvm::is_contained(ReturnedParams, Param1) &&
|
||||
llvm::is_contained(ReturnedParams, Param2);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ void ProperlySeededRandomGeneratorCheck::checkSeed(
|
||||
|
||||
const std::string SeedType(
|
||||
Func->getArg(0)->IgnoreCasts()->getType().getAsString());
|
||||
if (llvm::find(DisallowedSeedTypes, SeedType) != DisallowedSeedTypes.end()) {
|
||||
if (llvm::is_contained(DisallowedSeedTypes, SeedType)) {
|
||||
diag(Func->getExprLoc(),
|
||||
"random number generator seeded with a disallowed source of seed "
|
||||
"value will generate a predictable sequence of values");
|
||||
|
||||
@@ -60,7 +60,7 @@ public:
|
||||
size_type count(const T &V) const {
|
||||
if (isSmall()) {
|
||||
// Since the collection is small, just do a linear search.
|
||||
return llvm::find(Vector, V) == Vector.end() ? 0 : 1;
|
||||
return llvm::is_contained(Vector, V) ? 1 : 0;
|
||||
}
|
||||
|
||||
return Set.count(V);
|
||||
@@ -106,7 +106,7 @@ private:
|
||||
size_type count(const T &V) const {
|
||||
if (isSmall()) {
|
||||
// Since the collection is small, just do a linear search.
|
||||
return llvm::find(Vector, V) == Vector.end() ? 0 : 1;
|
||||
return llvm::is_contained(Vector, V) ? 1 : 0;
|
||||
}
|
||||
// Look-up in the Set.
|
||||
return Set.count(V);
|
||||
|
||||
@@ -80,7 +80,7 @@ void DuplicateIncludeCallbacks::InclusionDirective(
|
||||
bool IsAngled, CharSourceRange FilenameRange, Optional<FileEntryRef> File,
|
||||
StringRef SearchPath, StringRef RelativePath, const Module *Imported,
|
||||
SrcMgr::CharacteristicKind FileType) {
|
||||
if (llvm::find(Files.back(), FileName) != Files.back().end()) {
|
||||
if (llvm::is_contained(Files.back(), FileName)) {
|
||||
// We want to delete the entire line, so make sure that [Start,End] covers
|
||||
// everything.
|
||||
SourceLocation Start =
|
||||
|
||||
@@ -11673,7 +11673,7 @@ void ASTContext::forEachMultiversionedFunctionVersion(
|
||||
FD->getDeclContext()->getRedeclContext()->lookup(FD->getDeclName())) {
|
||||
FunctionDecl *CurFD = CurDecl->getAsFunction()->getMostRecentDecl();
|
||||
if (CurFD && hasSameType(CurFD->getType(), FD->getType()) &&
|
||||
std::end(SeenDecls) == llvm::find(SeenDecls, CurFD)) {
|
||||
!llvm::is_contained(SeenDecls, CurFD)) {
|
||||
SeenDecls.insert(CurFD);
|
||||
Pred(CurFD);
|
||||
}
|
||||
|
||||
@@ -3767,9 +3767,8 @@ public:
|
||||
bool IsModifierPresent = Stack->getDefaultmapModifier(ClauseKind) ==
|
||||
OMPC_DEFAULTMAP_MODIFIER_present;
|
||||
if (IsModifierPresent) {
|
||||
if (llvm::find(ImplicitMapModifier[ClauseKind],
|
||||
OMPC_MAP_MODIFIER_present) ==
|
||||
std::end(ImplicitMapModifier[ClauseKind])) {
|
||||
if (!llvm::is_contained(ImplicitMapModifier[ClauseKind],
|
||||
OMPC_MAP_MODIFIER_present)) {
|
||||
ImplicitMapModifier[ClauseKind].push_back(
|
||||
OMPC_MAP_MODIFIER_present);
|
||||
}
|
||||
|
||||
@@ -168,8 +168,7 @@ bool HexagonDYLDRendezvous::UpdateSOEntriesForAddition() {
|
||||
if (entry.path.empty() || ::strcmp(entry.path.c_str(), m_exe_path) == 0)
|
||||
continue;
|
||||
|
||||
pos = std::find(m_soentries.begin(), m_soentries.end(), entry);
|
||||
if (pos == m_soentries.end()) {
|
||||
if (!llvm::is_contained(m_soentries, entry)) {
|
||||
m_soentries.push_back(entry);
|
||||
m_added_soentries.push_back(entry);
|
||||
}
|
||||
@@ -188,8 +187,7 @@ bool HexagonDYLDRendezvous::UpdateSOEntriesForDeletion() {
|
||||
return false;
|
||||
|
||||
for (iterator I = begin(); I != end(); ++I) {
|
||||
pos = std::find(entry_list.begin(), entry_list.end(), *I);
|
||||
if (pos == entry_list.end())
|
||||
if (!llvm::is_contained(entry_list, *I))
|
||||
m_removed_soentries.push_back(*I);
|
||||
}
|
||||
|
||||
|
||||
@@ -396,8 +396,7 @@ bool DYLDRendezvous::AddSOEntries() {
|
||||
|
||||
UpdateFileSpecIfNecessary(entry);
|
||||
|
||||
pos = std::find(m_soentries.begin(), m_soentries.end(), entry);
|
||||
if (pos == m_soentries.end()) {
|
||||
if (!llvm::is_contained(m_soentries, entry)) {
|
||||
m_soentries.push_back(entry);
|
||||
m_added_soentries.push_back(entry);
|
||||
}
|
||||
@@ -416,8 +415,7 @@ bool DYLDRendezvous::RemoveSOEntries() {
|
||||
return false;
|
||||
|
||||
for (iterator I = begin(); I != end(); ++I) {
|
||||
pos = std::find(entry_list.begin(), entry_list.end(), *I);
|
||||
if (pos == entry_list.end())
|
||||
if (!llvm::is_contained(entry_list, *I))
|
||||
m_removed_soentries.push_back(*I);
|
||||
}
|
||||
|
||||
|
||||
@@ -331,7 +331,7 @@ PlatformSP PlatformAppleSimulator::CreateInstance(
|
||||
}
|
||||
|
||||
if (create) {
|
||||
if (std::count(supported_os.begin(), supported_os.end(), triple.getOS()))
|
||||
if (llvm::is_contained(supported_os, triple.getOS()))
|
||||
create = true;
|
||||
#if defined(__APPLE__)
|
||||
// Only accept "unknown" for the OS if the host is Apple and it
|
||||
|
||||
@@ -1618,9 +1618,7 @@ void SymbolFilePDB::GetTypesForPDBSymbol(const llvm::pdb::PDBSymbol &pdb_symbol,
|
||||
|
||||
if (can_parse) {
|
||||
if (auto *type = ResolveTypeUID(pdb_symbol.getSymIndexId())) {
|
||||
auto result =
|
||||
std::find(type_collection.begin(), type_collection.end(), type);
|
||||
if (result == type_collection.end())
|
||||
if (!llvm::is_contained(type_collection, type))
|
||||
type_collection.push_back(type);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user