diff options
Diffstat (limited to 'lib/ReaderWriter/MachO/MachOLinkingContext.cpp')
-rw-r--r-- | lib/ReaderWriter/MachO/MachOLinkingContext.cpp | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/lib/ReaderWriter/MachO/MachOLinkingContext.cpp b/lib/ReaderWriter/MachO/MachOLinkingContext.cpp index 61583963ddd7..38456024c9f8 100644 --- a/lib/ReaderWriter/MachO/MachOLinkingContext.cpp +++ b/lib/ReaderWriter/MachO/MachOLinkingContext.cpp @@ -1,9 +1,8 @@ //===- lib/ReaderWriter/MachO/MachOLinkingContext.cpp ---------------------===// // -// The LLVM Linker -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -768,8 +767,7 @@ void MachOLinkingContext::registerDylib(MachODylibFile *dylib, bool upward) const { std::lock_guard<std::mutex> lock(_dylibsMutex); - if (std::find(_allDylibs.begin(), - _allDylibs.end(), dylib) == _allDylibs.end()) + if (!llvm::count(_allDylibs, dylib)) _allDylibs.push_back(dylib); _pathToDylibMap[dylib->installName()] = dylib; // If path is different than install name, register path too. @@ -1016,11 +1014,10 @@ static bool isLibrary(const std::unique_ptr<Node> &elem) { // new undefines from libraries. void MachOLinkingContext::finalizeInputFiles() { std::vector<std::unique_ptr<Node>> &elements = getNodes(); - std::stable_sort(elements.begin(), elements.end(), - [](const std::unique_ptr<Node> &a, - const std::unique_ptr<Node> &b) { - return !isLibrary(a) && isLibrary(b); - }); + llvm::stable_sort(elements, [](const std::unique_ptr<Node> &a, + const std::unique_ptr<Node> &b) { + return !isLibrary(a) && isLibrary(b); + }); size_t numLibs = std::count_if(elements.begin(), elements.end(), isLibrary); elements.push_back(llvm::make_unique<GroupEnd>(numLibs)); } |