Simplify. NFC.

llvm-svn: 262174
This commit is contained in:
Rui Ueyama 2016-02-28 04:48:54 +00:00
parent b4d8c3bd2a
commit 7a6c9aed7a
1 changed files with 5 additions and 6 deletions

View File

@ -65,12 +65,11 @@ ArrayRef<uint8_t> LinkerScript::getFiller(StringRef Name) {
// A and B are mentioned in linker scripts. Otherwise, returns 0
// to use the default rule which is implemented in Writer.cpp.
int LinkerScript::compareSections(StringRef A, StringRef B) {
auto E = OutSections.end();
auto I = std::find_if(OutSections.begin(), E,
[&](OutSection &C) { return C.Name == A; });
auto J = std::find_if(OutSections.begin(), E,
[&](OutSection &C) { return C.Name == B; });
if (I == E || J == E)
auto Begin = OutSections.begin();
auto End = OutSections.end();
auto I = std::find_if(Begin, End, [&](OutSection &C) { return C.Name == A; });
auto J = std::find_if(Begin, End, [&](OutSection &C) { return C.Name == B; });
if (I == End || J == End)
return 0;
return I < J ? -1 : 1;
}