[llvm] r340241 - [llvm-objcopy] Simplify find(X, Y) != X.end() with is_contained()
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 20 17:13:52 PDT 2018
Author: maskray
Date: Mon Aug 20 17:13:52 2018
New Revision: 340241
URL: http://llvm.org/viewvc/llvm-project?rev=340241&view=rev
Log:
[llvm-objcopy] Simplify find(X,Y) != X.end() with is_contained()
Modified:
llvm/trunk/tools/llvm-objcopy/llvm-objcopy.cpp
Modified: llvm/trunk/tools/llvm-objcopy/llvm-objcopy.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objcopy/llvm-objcopy.cpp?rev=340241&r1=340240&r2=340241&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objcopy/llvm-objcopy.cpp (original)
+++ llvm/trunk/tools/llvm-objcopy/llvm-objcopy.cpp Mon Aug 20 17:13:52 2018
@@ -505,7 +505,7 @@ static void handleArgs(const CopyConfig
// 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
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
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);
More information about the llvm-commits
mailing list