// Register this in stubs maps
auto registerInMap = [&](StubGroupsTy &Map) {
StubGroupTy &StubGroup = Map[TgtSym];
- StubGroup.insert(std::lower_bound(StubGroup.begin(), StubGroup.end(),
- std::make_pair(AtAddress, nullptr),
- llvm::less_first()),
- std::make_pair(AtAddress, StubBB.get()));
+ StubGroup.insert(
+ std::lower_bound(
+ StubGroup.begin(), StubGroup.end(),
+ std::make_pair(AtAddress, nullptr),
+ [&](const std::pair<uint64_t, BinaryBasicBlock *> &LHS,
+ const std::pair<uint64_t, BinaryBasicBlock *> &RHS) {
+ return LHS.first < RHS.first;
+ }),
+ std::make_pair(AtAddress, StubBB.get()));
};
Stubs[&Func].insert(StubBB.get());
const StubGroupTy &Candidates = CandidatesIter->second;
if (Candidates.empty())
return nullptr;
- auto Cand =
- std::lower_bound(Candidates.begin(), Candidates.end(),
- std::make_pair(DotAddress, nullptr), llvm::less_first());
+ auto Cand = std::lower_bound(
+ Candidates.begin(), Candidates.end(), std::make_pair(DotAddress, nullptr),
+ [&](const std::pair<uint64_t, BinaryBasicBlock *> &LHS,
+ const std::pair<uint64_t, BinaryBasicBlock *> &RHS) {
+ return LHS.first < RHS.first;
+ });
if (Cand == Candidates.end())
return nullptr;
if (Cand != Candidates.begin()) {
for (auto &KeyVal : StubGroups) {
for (StubTy &Elem : KeyVal.second)
Elem.first = BBAddresses[Elem.second];
- std::sort(KeyVal.second.begin(), KeyVal.second.end(), llvm::less_first());
+ std::sort(KeyVal.second.begin(), KeyVal.second.end(),
+ [&](const std::pair<uint64_t, BinaryBasicBlock *> &LHS,
+ const std::pair<uint64_t, BinaryBasicBlock *> &RHS) {
+ return LHS.first < RHS.first;
+ });
}
};
// Sort header paths and make the header inclusion order deterministic
// across different OSs and filesystems.
- llvm::sort(Headers.begin(), Headers.end(), llvm::less_first());
+ llvm::sort(Headers.begin(), Headers.end(), [](
+ const std::pair<std::string, const FileEntry *> &LHS,
+ const std::pair<std::string, const FileEntry *> &RHS) {
+ return LHS.first < RHS.first;
+ });
for (auto &H : Headers) {
// Include this header as part of the umbrella directory.
Module->addTopHeader(H.second);
return;
// Sort based on the ideal order, first in the pair.
- llvm::sort(CorrelatedInitOrder, llvm::less_first());
+ llvm::sort(CorrelatedInitOrder,
+ [](auto &LHS, auto &RHS) { return LHS.first < RHS.first; });
// Introduce a new scope as SemaDiagnosticBuilder needs to be destroyed to
// emit the diagnostic before we can try adding notes.
std::make_pair(Names[i]->getName(), Exprs[i]));
// Sort NamedOperandList.
std::stable_sort(NamedOperandList.begin(), NamedOperandList.end(),
- llvm::less_first());
+ [](const NamedOperand &LHS, const NamedOperand &RHS) {
+ return LHS.first < RHS.first;
+ });
// Find adjacent duplicate operand.
SmallVector<NamedOperand, 4>::iterator Found =
std::adjacent_find(begin(NamedOperandList), end(NamedOperandList),
#undef ANALYZER_OPTION_DEPENDS_ON_USER_MODE
};
- llvm::sort(PrintableOptions, llvm::less_first());
+ llvm::sort(PrintableOptions, [](const OptionAndDescriptionTy &LHS,
+ const OptionAndDescriptionTy &RHS) {
+ return LHS.first < RHS.first;
+ });
for (const auto &Pair : PrintableOptions) {
AnalyzerOptions::printFormattedEntry(out, Pair, /*InitialPad*/ 2,
auto ExpectedRanges = FormatExpected<SourceRange>(Result.RangeAccessors);
- llvm::sort(ExpectedRanges, llvm::less_first());
+ llvm::sort(ExpectedRanges, [](const auto &LHS, const auto &RHS) {
+ return LHS.first < RHS.first;
+ });
// clang-format off
EXPECT_EQ(
/// Sort the lookup set by pointer value. This sort is fast but sensitive to
/// allocation order and so should not be used where a consistent order is
/// required.
- void sortByAddress() { llvm::sort(Symbols, llvm::less_first()); }
+ void sortByAddress() {
+ llvm::sort(Symbols, [](const value_type &LHS, const value_type &RHS) {
+ return LHS.first < RHS.first;
+ });
+ }
/// Sort the lookup set lexicographically. This sort is slow but the order
/// is unaffected by allocation order.
if (Attrs.empty())
return {};
- assert(llvm::is_sorted(Attrs, llvm::less_first()) &&
+ assert(llvm::is_sorted(Attrs,
+ [](const std::pair<unsigned, Attribute> &LHS,
+ const std::pair<unsigned, Attribute> &RHS) {
+ return LHS.first < RHS.first;
+ }) &&
"Misordered Attributes list!");
assert(llvm::all_of(Attrs,
[](const std::pair<unsigned, Attribute> &Pair) {
if (Attrs.empty())
return {};
- assert(llvm::is_sorted(Attrs, llvm::less_first()) &&
+ assert(llvm::is_sorted(Attrs,
+ [](const std::pair<unsigned, AttributeSet> &LHS,
+ const std::pair<unsigned, AttributeSet> &RHS) {
+ return LHS.first < RHS.first;
+ }) &&
"Misordered Attributes list!");
assert(llvm::none_of(Attrs,
[](const std::pair<unsigned, AttributeSet> &Pair) {
}
}
- llvm::sort(Queue, llvm::less_first());
+ llvm::sort(Queue, [](const WriteOperation &LHS, const WriteOperation &RHS) {
+ return LHS.first < RHS.first;
+ });
for (auto WriteOp : Queue)
(this->*WriteOp.second)();
Entries.reserve(Symbols.getNumItems());
for (const auto &Sym : Symbols)
Entries.push_back(std::make_pair(Sym.getKey(), Sym.getValue()));
- llvm::sort(Entries, llvm::less_first());
+ llvm::sort(Entries, [](const Entry &LHS, const Entry &RHS) {
+ return LHS.first < RHS.first;
+ });
for (const auto &Sym : Entries) {
if (Sym.second.ObjectAddress)
OS << format("\t%016" PRIx64, uint64_t(*Sym.second.ObjectAddress));
V.first, convertAttributeRefToAttributeSet(C, V.second));
});
- // All values are unique.
- sort(SetVec, llvm::less_first());
+ sort(SetVec, [](const std::pair<unsigned, AttributeSet> &LHS,
+ const std::pair<unsigned, AttributeSet> &RHS) {
+ return LHS.first < RHS.first; // All values are unique.
+ });
return AttributeList::get(C, SetVec);
}