Range-style std::find{,_if} -> llvm::find{,_if}. NFC

llvm-svn: 357359
This commit is contained in:
Fangrui Song 2019-03-31 08:48:19 +00:00
parent eaf4484e94
commit 75e74e077c
36 changed files with 72 additions and 105 deletions

View File

@ -113,12 +113,11 @@ public:
} }
DeclsTy &Vec = *getAsVector(); DeclsTy &Vec = *getAsVector();
DeclsTy::iterator I = std::find(Vec.begin(), Vec.end(), D); DeclsTy::iterator I = llvm::find(Vec, D);
assert(I != Vec.end() && "list does not contain decl"); assert(I != Vec.end() && "list does not contain decl");
Vec.erase(I); Vec.erase(I);
assert(std::find(Vec.begin(), Vec.end(), D) assert(llvm::find(Vec, D) == Vec.end() && "list still contains decl");
== Vec.end() && "list still contains decl");
} }
/// Remove any declarations which were imported from an external /// Remove any declarations which were imported from an external

View File

@ -1604,7 +1604,7 @@ public:
/// Return the index of BB, or Predecessors.size if BB is not a predecessor. /// Return the index of BB, or Predecessors.size if BB is not a predecessor.
unsigned findPredecessorIndex(const BasicBlock *BB) const { unsigned findPredecessorIndex(const BasicBlock *BB) const {
auto I = std::find(Predecessors.cbegin(), Predecessors.cend(), BB); auto I = llvm::find(Predecessors, BB);
return std::distance(Predecessors.cbegin(), I); return std::distance(Predecessors.cbegin(), I);
} }

View File

@ -64,7 +64,7 @@ bool CapturedDiagList::hasDiagnostic(ArrayRef<unsigned> IDs,
while (I != List.end()) { while (I != List.end()) {
FullSourceLoc diagLoc = I->getLocation(); FullSourceLoc diagLoc = I->getLocation();
if ((IDs.empty() || // empty means any diagnostic in the range. if ((IDs.empty() || // empty means any diagnostic in the range.
std::find(IDs.begin(), IDs.end(), I->getID()) != IDs.end()) && llvm::find(IDs, I->getID()) != IDs.end()) &&
!diagLoc.isBeforeInTranslationUnitThan(range.getBegin()) && !diagLoc.isBeforeInTranslationUnitThan(range.getBegin()) &&
(diagLoc == range.getEnd() || (diagLoc == range.getEnd() ||
diagLoc.isBeforeInTranslationUnitThan(range.getEnd()))) { diagLoc.isBeforeInTranslationUnitThan(range.getEnd()))) {

View File

@ -554,8 +554,7 @@ void OverridingMethods::add(unsigned OverriddenSubobject,
UniqueVirtualMethod Overriding) { UniqueVirtualMethod Overriding) {
SmallVectorImpl<UniqueVirtualMethod> &SubobjectOverrides SmallVectorImpl<UniqueVirtualMethod> &SubobjectOverrides
= Overrides[OverriddenSubobject]; = Overrides[OverriddenSubobject];
if (std::find(SubobjectOverrides.begin(), SubobjectOverrides.end(), if (llvm::find(SubobjectOverrides, Overriding) == SubobjectOverrides.end())
Overriding) == SubobjectOverrides.end())
SubobjectOverrides.push_back(Overriding); SubobjectOverrides.push_back(Overriding);
} }

View File

@ -1596,8 +1596,8 @@ void CXXRecordDecl::removeConversion(const NamedDecl *ConvDecl) {
for (unsigned I = 0, E = Convs.size(); I != E; ++I) { for (unsigned I = 0, E = Convs.size(); I != E; ++I) {
if (Convs[I].getDecl() == ConvDecl) { if (Convs[I].getDecl() == ConvDecl) {
Convs.erase(I); Convs.erase(I);
assert(std::find(Convs.begin(), Convs.end(), ConvDecl) == Convs.end() assert(llvm::find(Convs, ConvDecl) == Convs.end() &&
&& "conversion was found multiple times in unresolved set"); "conversion was found multiple times in unresolved set");
return; return;
} }
} }

View File

@ -1268,8 +1268,7 @@ void MicrosoftCXXNameMangler::mangleOperatorName(OverloadedOperatorKind OO,
void MicrosoftCXXNameMangler::mangleSourceName(StringRef Name) { void MicrosoftCXXNameMangler::mangleSourceName(StringRef Name) {
// <source name> ::= <identifier> @ // <source name> ::= <identifier> @
BackRefVec::iterator Found = BackRefVec::iterator Found = llvm::find(NameBackReferences, Name);
std::find(NameBackReferences.begin(), NameBackReferences.end(), Name);
if (Found == NameBackReferences.end()) { if (Found == NameBackReferences.end()) {
if (NameBackReferences.size() < 10) if (NameBackReferences.size() < 10)
NameBackReferences.push_back(Name); NameBackReferences.push_back(Name);
@ -3462,8 +3461,7 @@ void MicrosoftMangleContextImpl::mangleStringLiteral(const StringLiteral *SL,
} else { } else {
const char SpecialChars[] = {',', '/', '\\', ':', '.', const char SpecialChars[] = {',', '/', '\\', ':', '.',
' ', '\n', '\t', '\'', '-'}; ' ', '\n', '\t', '\'', '-'};
const char *Pos = const char *Pos = llvm::find(SpecialChars, Byte);
std::find(std::begin(SpecialChars), std::end(SpecialChars), Byte);
if (Pos != std::end(SpecialChars)) { if (Pos != std::end(SpecialChars)) {
Mangler.getStream() << '?' << (Pos - std::begin(SpecialChars)); Mangler.getStream() << '?' << (Pos - std::begin(SpecialChars));
} else { } else {

View File

@ -238,7 +238,7 @@ EmptySubobjectMap::CanPlaceSubobjectAtOffset(const CXXRecordDecl *RD,
return true; return true;
const ClassVectorTy &Classes = I->second; const ClassVectorTy &Classes = I->second;
if (std::find(Classes.begin(), Classes.end(), RD) == Classes.end()) if (llvm::find(Classes, RD) == Classes.end())
return true; return true;
// There is already an empty class of the same type at this offset. // There is already an empty class of the same type at this offset.

View File

@ -1062,8 +1062,7 @@ void ItaniumVTableBuilder::AddThunk(const CXXMethodDecl *MD,
SmallVectorImpl<ThunkInfo> &ThunksVector = Thunks[MD]; SmallVectorImpl<ThunkInfo> &ThunksVector = Thunks[MD];
// Check if we have this thunk already. // Check if we have this thunk already.
if (std::find(ThunksVector.begin(), ThunksVector.end(), Thunk) != if (llvm::find(ThunksVector, Thunk) != ThunksVector.end())
ThunksVector.end())
return; return;
ThunksVector.push_back(Thunk); ThunksVector.push_back(Thunk);
@ -2452,8 +2451,7 @@ private:
SmallVector<ThunkInfo, 1> &ThunksVector = Thunks[MD]; SmallVector<ThunkInfo, 1> &ThunksVector = Thunks[MD];
// Check if we have this thunk already. // Check if we have this thunk already.
if (std::find(ThunksVector.begin(), ThunksVector.end(), Thunk) != if (llvm::find(ThunksVector, Thunk) != ThunksVector.end())
ThunksVector.end())
return; return;
ThunksVector.push_back(Thunk); ThunksVector.push_back(Thunk);

View File

@ -476,7 +476,7 @@ bool ARMTargetInfo::handleTargetFeatures(std::vector<std::string> &Features,
Features.push_back("-neonfp"); Features.push_back("-neonfp");
// Remove front-end specific options which the backend handles differently. // Remove front-end specific options which the backend handles differently.
auto Feature = std::find(Features.begin(), Features.end(), "+soft-float-abi"); auto Feature = llvm::find(Features, "+soft-float-abi");
if (Feature != Features.end()) if (Feature != Features.end())
Features.erase(Feature); Features.erase(Feature);

View File

@ -214,31 +214,26 @@ void PPCTargetInfo::getTargetDefines(const LangOptions &Opts,
static bool ppcUserFeaturesCheck(DiagnosticsEngine &Diags, static bool ppcUserFeaturesCheck(DiagnosticsEngine &Diags,
const std::vector<std::string> &FeaturesVec) { const std::vector<std::string> &FeaturesVec) {
if (std::find(FeaturesVec.begin(), FeaturesVec.end(), "-vsx") != if (llvm::find(FeaturesVec, "-vsx") != FeaturesVec.end()) {
FeaturesVec.end()) { if (llvm::find(FeaturesVec, "+power8-vector") != FeaturesVec.end()) {
if (std::find(FeaturesVec.begin(), FeaturesVec.end(), "+power8-vector") !=
FeaturesVec.end()) {
Diags.Report(diag::err_opt_not_valid_with_opt) << "-mpower8-vector" Diags.Report(diag::err_opt_not_valid_with_opt) << "-mpower8-vector"
<< "-mno-vsx"; << "-mno-vsx";
return false; return false;
} }
if (std::find(FeaturesVec.begin(), FeaturesVec.end(), "+direct-move") != if (llvm::find(FeaturesVec, "+direct-move") != FeaturesVec.end()) {
FeaturesVec.end()) {
Diags.Report(diag::err_opt_not_valid_with_opt) << "-mdirect-move" Diags.Report(diag::err_opt_not_valid_with_opt) << "-mdirect-move"
<< "-mno-vsx"; << "-mno-vsx";
return false; return false;
} }
if (std::find(FeaturesVec.begin(), FeaturesVec.end(), "+float128") != if (llvm::find(FeaturesVec, "+float128") != FeaturesVec.end()) {
FeaturesVec.end()) {
Diags.Report(diag::err_opt_not_valid_with_opt) << "-mfloat128" Diags.Report(diag::err_opt_not_valid_with_opt) << "-mfloat128"
<< "-mno-vsx"; << "-mno-vsx";
return false; return false;
} }
if (std::find(FeaturesVec.begin(), FeaturesVec.end(), "+power9-vector") != if (llvm::find(FeaturesVec, "+power9-vector") != FeaturesVec.end()) {
FeaturesVec.end()) {
Diags.Report(diag::err_opt_not_valid_with_opt) << "-mpower9-vector" Diags.Report(diag::err_opt_not_valid_with_opt) << "-mpower9-vector"
<< "-mno-vsx"; << "-mno-vsx";
return false; return false;
@ -311,8 +306,7 @@ bool PPCTargetInfo::initFeatureMap(
return false; return false;
if (!(ArchDefs & ArchDefinePwr9) && (ArchDefs & ArchDefinePpcgr) && if (!(ArchDefs & ArchDefinePwr9) && (ArchDefs & ArchDefinePpcgr) &&
std::find(FeaturesVec.begin(), FeaturesVec.end(), "+float128") != llvm::find(FeaturesVec, "+float128") != FeaturesVec.end()) {
FeaturesVec.end()) {
// We have __float128 on PPC but not power 9 and above. // We have __float128 on PPC but not power 9 and above.
Diags.Report(diag::err_opt_not_valid_with_opt) << "-mfloat128" << CPU; Diags.Report(diag::err_opt_not_valid_with_opt) << "-mfloat128" << CPU;
return false; return false;

View File

@ -39,7 +39,7 @@ public:
bool handleTargetFeatures(std::vector<std::string> &Features, bool handleTargetFeatures(std::vector<std::string> &Features,
DiagnosticsEngine &Diags) override { DiagnosticsEngine &Diags) override {
// Check if software floating point is enabled // Check if software floating point is enabled
auto Feature = std::find(Features.begin(), Features.end(), "+soft-float"); auto Feature = llvm::find(Features, "+soft-float");
if (Feature != Features.end()) { if (Feature != Features.end()) {
SoftFloat = true; SoftFloat = true;
} }

View File

@ -427,23 +427,20 @@ bool X86TargetInfo::initFeatureMap(
// Enable popcnt if sse4.2 is enabled and popcnt is not explicitly disabled. // Enable popcnt if sse4.2 is enabled and popcnt is not explicitly disabled.
auto I = Features.find("sse4.2"); auto I = Features.find("sse4.2");
if (I != Features.end() && I->getValue() && if (I != Features.end() && I->getValue() &&
std::find(FeaturesVec.begin(), FeaturesVec.end(), "-popcnt") == llvm::find(FeaturesVec, "-popcnt") == FeaturesVec.end())
FeaturesVec.end())
Features["popcnt"] = true; Features["popcnt"] = true;
// Enable prfchw if 3DNow! is enabled and prfchw is not explicitly disabled. // Enable prfchw if 3DNow! is enabled and prfchw is not explicitly disabled.
I = Features.find("3dnow"); I = Features.find("3dnow");
if (I != Features.end() && I->getValue() && if (I != Features.end() && I->getValue() &&
std::find(FeaturesVec.begin(), FeaturesVec.end(), "-prfchw") == llvm::find(FeaturesVec, "-prfchw") == FeaturesVec.end())
FeaturesVec.end())
Features["prfchw"] = true; Features["prfchw"] = true;
// Additionally, if SSE is enabled and mmx is not explicitly disabled, // Additionally, if SSE is enabled and mmx is not explicitly disabled,
// then enable MMX. // then enable MMX.
I = Features.find("sse"); I = Features.find("sse");
if (I != Features.end() && I->getValue() && if (I != Features.end() && I->getValue() &&
std::find(FeaturesVec.begin(), FeaturesVec.end(), "-mmx") == llvm::find(FeaturesVec, "-mmx") == FeaturesVec.end())
FeaturesVec.end())
Features["mmx"] = true; Features["mmx"] = true;
return true; return true;

View File

@ -250,7 +250,7 @@ void Command::Print(raw_ostream &OS, const char *Terminator, bool Quote,
} }
} }
auto Found = std::find_if(InputFilenames.begin(), InputFilenames.end(), auto Found = llvm::find_if(InputFilenames,
[&Arg](StringRef IF) { return IF == Arg; }); [&Arg](StringRef IF) { return IF == Arg; });
if (Found != InputFilenames.end() && if (Found != InputFilenames.end() &&
(i == 0 || StringRef(Args[i - 1]) != "-main-file-name")) { (i == 0 || StringRef(Args[i - 1]) != "-main-file-name")) {

View File

@ -3682,9 +3682,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
options::OPT_mllvm, options::OPT_mllvm,
}; };
for (const auto &A : Args) for (const auto &A : Args)
if (std::find(std::begin(kBitcodeOptionBlacklist), if (llvm::find(kBitcodeOptionBlacklist, A->getOption().getID()) !=
std::end(kBitcodeOptionBlacklist),
A->getOption().getID()) !=
std::end(kBitcodeOptionBlacklist)) std::end(kBitcodeOptionBlacklist))
D.Diag(diag::err_drv_unsupported_embed_bitcode) << A->getSpelling(); D.Diag(diag::err_drv_unsupported_embed_bitcode) << A->getSpelling();

View File

@ -430,7 +430,7 @@ void HexagonToolChain::getHexagonLibraryPaths(const ArgList &Args,
std::string TargetDir = getHexagonTargetDir(D.getInstalledDir(), std::string TargetDir = getHexagonTargetDir(D.getInstalledDir(),
D.PrefixDirs); D.PrefixDirs);
if (std::find(RootDirs.begin(), RootDirs.end(), TargetDir) == RootDirs.end()) if (llvm::find(RootDirs, TargetDir) == RootDirs.end())
RootDirs.push_back(TargetDir); RootDirs.push_back(TargetDir);
bool HasPIC = Args.hasArg(options::OPT_fpic, options::OPT_fPIC); bool HasPIC = Args.hasArg(options::OPT_fpic, options::OPT_fPIC);

View File

@ -60,7 +60,7 @@ void EditedSource::finishedCommit() {
MacroArgUse ArgUse; MacroArgUse ArgUse;
std::tie(ExpLoc, ArgUse) = ExpArg; std::tie(ExpLoc, ArgUse) = ExpArg;
auto &ArgUses = ExpansionToArgMap[ExpLoc.getRawEncoding()]; auto &ArgUses = ExpansionToArgMap[ExpLoc.getRawEncoding()];
if (std::find(ArgUses.begin(), ArgUses.end(), ArgUse) == ArgUses.end()) if (llvm::find(ArgUses, ArgUse) == ArgUses.end())
ArgUses.push_back(ArgUse); ArgUses.push_back(ArgUse);
} }
CurrCommitMacroArgExps.clear(); CurrCommitMacroArgExps.clear();

View File

@ -1413,9 +1413,9 @@ static bool checkVerifyPrefixes(const std::vector<std::string> &VerifyPrefixes,
for (const auto &Prefix : VerifyPrefixes) { for (const auto &Prefix : VerifyPrefixes) {
// Every prefix must start with a letter and contain only alphanumeric // Every prefix must start with a letter and contain only alphanumeric
// characters, hyphens, and underscores. // characters, hyphens, and underscores.
auto BadChar = std::find_if(Prefix.begin(), Prefix.end(), auto BadChar = llvm::find_if(Prefix, [](char C) {
[](char C){return !isAlphanumeric(C) return !isAlphanumeric(C) && C != '-' && C != '_';
&& C != '-' && C != '_';}); });
if (BadChar != Prefix.end() || !isLetter(Prefix[0])) { if (BadChar != Prefix.end() || !isLetter(Prefix[0])) {
Success = false; Success = false;
if (Diags) { if (Diags) {

View File

@ -333,8 +333,7 @@ static void selectInterestingSourceRegion(std::string &SourceLine,
// No special characters are allowed in CaretLine. // No special characters are allowed in CaretLine.
assert(CaretLine.end() == assert(CaretLine.end() ==
std::find_if(CaretLine.begin(), CaretLine.end(), llvm::find_if(CaretLine, [](char c) { return c < ' ' || '~' < c; }));
[](char c) { return c < ' ' || '~' < c; }));
// Find the slice that we need to display the full caret line // Find the slice that we need to display the full caret line
// correctly. // correctly.

View File

@ -411,8 +411,7 @@ bool IndexingContext::handleDeclOccurrence(const Decl *D, SourceLocation Loc,
FinalRelations.reserve(Relations.size()+1); FinalRelations.reserve(Relations.size()+1);
auto addRelation = [&](SymbolRelation Rel) { auto addRelation = [&](SymbolRelation Rel) {
auto It = std::find_if(FinalRelations.begin(), FinalRelations.end(), auto It = llvm::find_if(FinalRelations, [&](SymbolRelation Elem) -> bool {
[&](SymbolRelation Elem)->bool {
return Elem.RelatedSymbol == Rel.RelatedSymbol; return Elem.RelatedSymbol == Rel.RelatedSymbol;
}); });
if (It != FinalRelations.end()) { if (It != FinalRelations.end()) {

View File

@ -2210,8 +2210,7 @@ bool Preprocessor::ReadMacroParameterList(MacroInfo *MI, Token &Tok) {
// If this is already used as a parameter, it is used multiple times (e.g. // If this is already used as a parameter, it is used multiple times (e.g.
// #define X(A,A. // #define X(A,A.
if (std::find(Parameters.begin(), Parameters.end(), II) != if (llvm::find(Parameters, II) != Parameters.end()) { // C99 6.10.3p6
Parameters.end()) { // C99 6.10.3p6
Diag(Tok, diag::err_pp_duplicate_name_in_arg_list) << II; Diag(Tok, diag::err_pp_duplicate_name_in_arg_list) << II;
return true; return true;
} }

View File

@ -1132,14 +1132,14 @@ bool Preprocessor::parseSimpleIntegerLiteral(Token &Tok, uint64_t &Value) {
void Preprocessor::addCommentHandler(CommentHandler *Handler) { void Preprocessor::addCommentHandler(CommentHandler *Handler) {
assert(Handler && "NULL comment handler"); assert(Handler && "NULL comment handler");
assert(std::find(CommentHandlers.begin(), CommentHandlers.end(), Handler) == assert(llvm::find(CommentHandlers, Handler) == CommentHandlers.end() &&
CommentHandlers.end() && "Comment handler already registered"); "Comment handler already registered");
CommentHandlers.push_back(Handler); CommentHandlers.push_back(Handler);
} }
void Preprocessor::removeCommentHandler(CommentHandler *Handler) { void Preprocessor::removeCommentHandler(CommentHandler *Handler) {
std::vector<CommentHandler *>::iterator Pos = std::vector<CommentHandler *>::iterator Pos =
std::find(CommentHandlers.begin(), CommentHandlers.end(), Handler); llvm::find(CommentHandlers, Handler);
assert(Pos != CommentHandlers.end() && "Comment handler not registered"); assert(Pos != CommentHandlers.end() && "Comment handler not registered");
CommentHandlers.erase(Pos); CommentHandlers.erase(Pos);
} }

View File

@ -126,8 +126,7 @@ struct EffectiveContext {
bool includesClass(const CXXRecordDecl *R) const { bool includesClass(const CXXRecordDecl *R) const {
R = R->getCanonicalDecl(); R = R->getCanonicalDecl();
return std::find(Records.begin(), Records.end(), R) return llvm::find(Records, R) != Records.end();
!= Records.end();
} }
/// Retrieves the innermost "useful" context. Can be null if we're /// Retrieves the innermost "useful" context. Can be null if we're

View File

@ -13923,8 +13923,7 @@ void Sema::DiscardMisalignedMemberAddress(const Type *T, Expr *E) {
cast<UnaryOperator>(E)->getOpcode() == UO_AddrOf) { cast<UnaryOperator>(E)->getOpcode() == UO_AddrOf) {
auto *Op = cast<UnaryOperator>(E)->getSubExpr()->IgnoreParens(); auto *Op = cast<UnaryOperator>(E)->getSubExpr()->IgnoreParens();
if (isa<MemberExpr>(Op)) { if (isa<MemberExpr>(Op)) {
auto MA = std::find(MisalignedMembers.begin(), MisalignedMembers.end(), auto MA = llvm::find(MisalignedMembers, MisalignedMember(Op));
MisalignedMember(Op));
if (MA != MisalignedMembers.end() && if (MA != MisalignedMembers.end() &&
(T->isIntegerType() || (T->isIntegerType() ||
(T->isPointerType() && (T->getPointeeType()->isIncompleteType() || (T->isPointerType() && (T->getPointeeType()->isIncompleteType() ||

View File

@ -8084,8 +8084,7 @@ static bool isOpenCLSizeDependentType(ASTContext &C, QualType Ty) {
QualType DesugaredTy = Ty; QualType DesugaredTy = Ty;
do { do {
ArrayRef<StringRef> Names(SizeTypeNames); ArrayRef<StringRef> Names(SizeTypeNames);
auto Match = auto Match = llvm::find(Names, DesugaredTy.getAsString());
std::find(Names.begin(), Names.end(), DesugaredTy.getAsString());
if (Names.end() != Match) if (Names.end() != Match)
return true; return true;

View File

@ -16975,8 +16975,7 @@ ExprResult Sema::ActOnObjCAvailabilityCheckExpr(
StringRef Platform = getASTContext().getTargetInfo().getPlatformName(); StringRef Platform = getASTContext().getTargetInfo().getPlatformName();
auto Spec = std::find_if(AvailSpecs.begin(), AvailSpecs.end(), auto Spec = llvm::find_if(AvailSpecs, [&](const AvailabilitySpec &Spec) {
[&](const AvailabilitySpec &Spec) {
return Spec.getPlatform() == Platform; return Spec.getPlatform() == Platform;
}); });

View File

@ -4338,9 +4338,8 @@ void TypoCorrectionConsumer::NamespaceSpecifierSet::addNameSpecifier(
SpecifierOStream.flush(); SpecifierOStream.flush();
SameNameSpecifier = NewNameSpecifier == CurNameSpecifier; SameNameSpecifier = NewNameSpecifier == CurNameSpecifier;
} }
if (SameNameSpecifier || if (SameNameSpecifier || llvm::find(CurContextIdentifiers, Name) !=
std::find(CurContextIdentifiers.begin(), CurContextIdentifiers.end(), CurContextIdentifiers.end()) {
Name) != CurContextIdentifiers.end()) {
// Rebuild the NestedNameSpecifier as a globally-qualified specifier. // Rebuild the NestedNameSpecifier as a globally-qualified specifier.
NNS = NestedNameSpecifier::GlobalSpecifier(Context); NNS = NestedNameSpecifier::GlobalSpecifier(Context);
NumSpecifiers = NumSpecifiers =

View File

@ -1942,8 +1942,7 @@ static void DiagnoseUnimplementedAccessor(
llvm::SmallPtrSet<const ObjCMethodDecl *, 8> &SMap) { llvm::SmallPtrSet<const ObjCMethodDecl *, 8> &SMap) {
// Check to see if we have a corresponding selector in SMap and with the // Check to see if we have a corresponding selector in SMap and with the
// right method type. // right method type.
auto I = std::find_if(SMap.begin(), SMap.end(), auto I = llvm::find_if(SMap, [&](const ObjCMethodDecl *x) {
[&](const ObjCMethodDecl *x) {
return x->getSelector() == Method && return x->getSelector() == Method &&
x->isClassMethod() == Prop->isClassProperty(); x->isClassMethod() == Prop->isClassProperty();
}); });

View File

@ -8528,7 +8528,7 @@ unsigned ASTReader::getModuleFileID(ModuleFile *F) {
return ((F->BaseSubmoduleID + NUM_PREDEF_SUBMODULE_IDS) << 1) | 1; return ((F->BaseSubmoduleID + NUM_PREDEF_SUBMODULE_IDS) << 1) | 1;
auto PCHModules = getModuleManager().pch_modules(); auto PCHModules = getModuleManager().pch_modules();
auto I = std::find(PCHModules.begin(), PCHModules.end(), F); auto I = llvm::find(PCHModules, F);
assert(I != PCHModules.end() && "emitting reference to unknown file"); assert(I != PCHModules.end() && "emitting reference to unknown file");
return (I - PCHModules.end()) << 1; return (I - PCHModules.end()) << 1;
} }

View File

@ -254,8 +254,7 @@ void ModuleManager::removeModules(
// Remove the modules from the PCH chain. // Remove the modules from the PCH chain.
for (auto I = First; I != Last; ++I) { for (auto I = First; I != Last; ++I) {
if (!I->isModule()) { if (!I->isModule()) {
PCHChain.erase(std::find(PCHChain.begin(), PCHChain.end(), &*I), PCHChain.erase(llvm::find(PCHChain, &*I), PCHChain.end());
PCHChain.end());
break; break;
} }
} }

View File

@ -204,7 +204,7 @@ void MIGChecker::checkPostCall(const CallEvent &Call, CheckerContext &C) const {
if (!isInMIGCall(C)) if (!isInMIGCall(C))
return; return;
auto I = std::find_if(Deallocators.begin(), Deallocators.end(), auto I = llvm::find_if(Deallocators,
[&](const std::pair<CallDescription, unsigned> &Item) { [&](const std::pair<CallDescription, unsigned> &Item) {
return Call.isCalled(Item.first); return Call.isCalled(Item.first);
}); });

View File

@ -1369,8 +1369,7 @@ static void addContextEdges(PathPieces &pieces, SourceManager &SM,
break; break;
// If the source is in the same context, we're already good. // If the source is in the same context, we're already good.
if (std::find(SrcContexts.begin(), SrcContexts.end(), DstContext) != if (llvm::find(SrcContexts, DstContext) != SrcContexts.end())
SrcContexts.end())
break; break;
// Update the subexpression node to point to the context edge. // Update the subexpression node to point to the context edge.

View File

@ -340,7 +340,7 @@ int main(int argc_, const char **argv_) {
// response files written by clang will tokenize the same way in either mode. // response files written by clang will tokenize the same way in either mode.
bool ClangCLMode = false; bool ClangCLMode = false;
if (StringRef(TargetAndMode.DriverMode).equals("--driver-mode=cl") || if (StringRef(TargetAndMode.DriverMode).equals("--driver-mode=cl") ||
std::find_if(argv.begin(), argv.end(), [](const char *F) { llvm::find_if(argv, [](const char *F) {
return F && strcmp(F, "--driver-mode=cl") == 0; return F && strcmp(F, "--driver-mode=cl") == 0;
}) != argv.end()) { }) != argv.end()) {
ClangCLMode = true; ClangCLMode = true;

View File

@ -109,16 +109,14 @@ struct FindFileIdRefVisitData {
private: private:
bool isOverriddingMethod(const Decl *D) const { bool isOverriddingMethod(const Decl *D) const {
if (std::find(TopMethods.begin(), TopMethods.end(), D) != if (llvm::find(TopMethods, D) != TopMethods.end())
TopMethods.end())
return true; return true;
TopMethodsTy methods; TopMethodsTy methods;
getTopOverriddenMethods(TU, D, methods); getTopOverriddenMethods(TU, D, methods);
for (TopMethodsTy::iterator for (TopMethodsTy::iterator
I = methods.begin(), E = methods.end(); I != E; ++I) { I = methods.begin(), E = methods.end(); I != E; ++I) {
if (std::find(TopMethods.begin(), TopMethods.end(), *I) != if (llvm::find(TopMethods, *I) != TopMethods.end())
TopMethods.end())
return true; return true;
} }

View File

@ -109,8 +109,8 @@ CXCursor cxcursor::MakeCXCursor(const Decl *D, CXTranslationUnit TU,
RegionOfInterest.getBegin() == RegionOfInterest.getEnd()) { RegionOfInterest.getBegin() == RegionOfInterest.getEnd()) {
SmallVector<SourceLocation, 16> SelLocs; SmallVector<SourceLocation, 16> SelLocs;
cast<ObjCMethodDecl>(D)->getSelectorLocs(SelLocs); cast<ObjCMethodDecl>(D)->getSelectorLocs(SelLocs);
SmallVectorImpl<SourceLocation>::iterator SmallVectorImpl<SourceLocation>::iterator I =
I=std::find(SelLocs.begin(), SelLocs.end(),RegionOfInterest.getBegin()); llvm::find(SelLocs, RegionOfInterest.getBegin());
if (I != SelLocs.end()) if (I != SelLocs.end())
SelectorIdIndex = I - SelLocs.begin(); SelectorIdIndex = I - SelLocs.begin();
} }
@ -562,8 +562,8 @@ CXCursor cxcursor::MakeCXCursor(const Stmt *S, const Decl *Parent,
RegionOfInterest.getBegin() == RegionOfInterest.getEnd()) { RegionOfInterest.getBegin() == RegionOfInterest.getEnd()) {
SmallVector<SourceLocation, 16> SelLocs; SmallVector<SourceLocation, 16> SelLocs;
cast<ObjCMessageExpr>(S)->getSelectorLocs(SelLocs); cast<ObjCMessageExpr>(S)->getSelectorLocs(SelLocs);
SmallVectorImpl<SourceLocation>::iterator SmallVectorImpl<SourceLocation>::iterator I =
I=std::find(SelLocs.begin(), SelLocs.end(),RegionOfInterest.getBegin()); llvm::find(SelLocs, RegionOfInterest.getBegin());
if (I != SelLocs.end()) if (I != SelLocs.end())
SelectorIdIndex = I - SelLocs.begin(); SelectorIdIndex = I - SelLocs.begin();
} }

View File

@ -381,7 +381,7 @@ class ASTImporterTestBase : public CompilerOptionSpecificTest {
// Create a virtual file in the To Ctx which corresponds to the file from // Create a virtual file in the To Ctx which corresponds to the file from
// which we want to import the `From` Decl. Without this source locations // which we want to import the `From` Decl. Without this source locations
// will be invalid in the ToCtx. // will be invalid in the ToCtx.
auto It = std::find_if(FromTUs.begin(), FromTUs.end(), [From](const TU &E) { auto It = llvm::find_if(FromTUs, [From](const TU &E) {
return E.TUDecl == From->getTranslationUnitDecl(); return E.TUDecl == From->getTranslationUnitDecl();
}); });
assert(It != FromTUs.end()); assert(It != FromTUs.end());
@ -435,8 +435,7 @@ public:
// name). // name).
TranslationUnitDecl *getTuDecl(StringRef SrcCode, Language Lang, TranslationUnitDecl *getTuDecl(StringRef SrcCode, Language Lang,
StringRef FileName = "input.cc") { StringRef FileName = "input.cc") {
assert( assert(llvm::find_if(FromTUs, [FileName](const TU &E) {
std::find_if(FromTUs.begin(), FromTUs.end(), [FileName](const TU &E) {
return E.FileName == FileName; return E.FileName == FileName;
}) == FromTUs.end()); }) == FromTUs.end());

View File

@ -440,8 +440,7 @@ TEST(ClangToolTest, StripDependencyFileAdjuster) {
Tool.run(Action.get()); Tool.run(Action.get());
auto HasFlag = [&FinalArgs](const std::string &Flag) { auto HasFlag = [&FinalArgs](const std::string &Flag) {
return std::find(FinalArgs.begin(), FinalArgs.end(), Flag) != return llvm::find(FinalArgs, Flag) != FinalArgs.end();
FinalArgs.end();
}; };
EXPECT_FALSE(HasFlag("-MD")); EXPECT_FALSE(HasFlag("-MD"));
EXPECT_FALSE(HasFlag("-MMD")); EXPECT_FALSE(HasFlag("-MMD"));
@ -472,8 +471,7 @@ TEST(ClangToolTest, StripPluginsAdjuster) {
Tool.run(Action.get()); Tool.run(Action.get());
auto HasFlag = [&FinalArgs](const std::string &Flag) { auto HasFlag = [&FinalArgs](const std::string &Flag) {
return std::find(FinalArgs.begin(), FinalArgs.end(), Flag) != return llvm::find(FinalArgs, Flag) != FinalArgs.end();
FinalArgs.end();
}; };
EXPECT_FALSE(HasFlag("-Xclang")); EXPECT_FALSE(HasFlag("-Xclang"));
EXPECT_FALSE(HasFlag("-add-plugin")); EXPECT_FALSE(HasFlag("-add-plugin"));