From 0e49ef9540b54403bf1b8c40626275bc9883e8c9 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Tue, 21 Aug 2018 00:13:52 +0000 Subject: [PATCH] [llvm-objcopy] Simplify find(X,Y) != X.end() with is_contained() llvm-svn: 340241 --- llvm/tools/llvm-objcopy/llvm-objcopy.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/llvm/tools/llvm-objcopy/llvm-objcopy.cpp b/llvm/tools/llvm-objcopy/llvm-objcopy.cpp index b2a6ed44c00d..0bf9bc47d01c 100644 --- a/llvm/tools/llvm-objcopy/llvm-objcopy.cpp +++ b/llvm/tools/llvm-objcopy/llvm-objcopy.cpp @@ -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);