[llvm-objcopy] Simplify find(X,Y) != X.end() with is_contained()

llvm-svn: 340241
This commit is contained in:
Fangrui Song 2018-08-21 00:13:52 +00:00
parent 1d432ae284
commit 0e49ef9540
1 changed files with 3 additions and 3 deletions

View File

@ -505,7 +505,7 @@ static void handleArgs(const CopyConfig &Config, Object &Obj,
// Removes:
if (!Config.ToRemove.empty()) {
RemovePred = [&Config](const SectionBase &Sec) {
return find(Config.ToRemove, Sec.Name) != Config.ToRemove.end();
return is_contained(Config.ToRemove, Sec.Name);
};
}
@ -573,7 +573,7 @@ static void handleArgs(const CopyConfig &Config, Object &Obj,
if (!Config.OnlyKeep.empty()) {
RemovePred = [&Config, RemovePred, &Obj](const SectionBase &Sec) {
// Explicitly keep these sections regardless of previous removes.
if (find(Config.OnlyKeep, Sec.Name) != Config.OnlyKeep.end())
if (is_contained(Config.OnlyKeep, Sec.Name))
return false;
// Allow all implicit removes.
@ -595,7 +595,7 @@ static void handleArgs(const CopyConfig &Config, Object &Obj,
if (!Config.Keep.empty()) {
RemovePred = [Config, RemovePred](const SectionBase &Sec) {
// Explicitly keep these sections regardless of previous removes.
if (find(Config.Keep, Sec.Name) != Config.Keep.end())
if (is_contained(Config.Keep, Sec.Name))
return false;
// Otherwise defer to RemovePred.
return RemovePred(Sec);