SourceInfo Function::getSource(CodePtr PC) const {
unsigned Offset = PC - getCodeBegin();
using Elem = std::pair<unsigned, SourceInfo>;
- auto It = std::lower_bound(SrcMap.begin(), SrcMap.end(), Elem{Offset, {}},
- [](Elem A, Elem B) { return A.first < B.first; });
+ auto It = llvm::lower_bound(SrcMap, Elem{Offset, {}}, llvm::less_first());
if (It == SrcMap.end() || It->first != Offset)
llvm::report_fatal_error("missing source location");
return It->second;
// Sort header paths and make the header inclusion order deterministic
// across different OSs and filesystems.
- 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;
- });
+ llvm::sort(Headers.begin(), Headers.end(), llvm::less_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,
- [](auto &LHS, auto &RHS) { return LHS.first < RHS.first; });
+ llvm::sort(CorrelatedInitOrder, llvm::less_first());
// Introduce a new scope as SemaDiagnosticBuilder needs to be destroyed to
// emit the diagnostic before we can try adding notes.
NamedOperandList.emplace_back(
std::make_pair(Names[i]->getName(), Exprs[i]));
// Sort NamedOperandList.
- std::stable_sort(NamedOperandList.begin(), NamedOperandList.end(),
- [](const NamedOperand &LHS, const NamedOperand &RHS) {
- return LHS.first < RHS.first;
- });
+ llvm::stable_sort(NamedOperandList, llvm::less_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, [](const OptionAndDescriptionTy &LHS,
- const OptionAndDescriptionTy &RHS) {
- return LHS.first < RHS.first;
- });
+ llvm::sort(PrintableOptions, llvm::less_first());
for (const auto &Pair : PrintableOptions) {
AnalyzerOptions::printFormattedEntry(out, Pair, /*InitialPad*/ 2,
void UdtRecordCompleter::complete() {
// Ensure the correct order for virtual bases.
- std::stable_sort(m_bases.begin(), m_bases.end(),
- [](const IndexedBase &lhs, const IndexedBase &rhs) {
- return lhs.first < rhs.first;
- });
+ llvm::stable_sort(m_bases, llvm::less_first());
std::vector<std::unique_ptr<clang::CXXBaseSpecifier>> bases;
bases.reserve(m_bases.size());
std::vector<KeyAndTS> sorted_typesystems;
for (const auto &a : m_isolated_asts)
sorted_typesystems.emplace_back(a.first, a.second.get());
- llvm::stable_sort(sorted_typesystems,
- [](const KeyAndTS &lhs, const KeyAndTS &rhs) {
- return lhs.first < rhs.first;
- });
+ llvm::stable_sort(sorted_typesystems, llvm::less_first());
// Dump each sub-AST too.
for (const auto &a : sorted_typesystems) {
/// 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, [](const value_type &LHS, const value_type &RHS) {
- return LHS.first < RHS.first;
- });
- }
+ void sortByAddress() { llvm::sort(Symbols, llvm::less_first()); }
/// Sort the lookup set lexicographically. This sort is slow but the order
/// is unaffected by allocation order.
StringInstrMap.push_back({(i == std::string::npos) ? S : S.substr(i), II});
}
- llvm::sort(StringInstrMap,
- [](const StringInstrPair &a, const StringInstrPair &b) -> bool {
- return (a.first < b.first);
- });
+ llvm::sort(StringInstrMap, llvm::less_first());
for (auto &II : StringInstrMap) {
if (Attrs.empty())
return {};
- assert(llvm::is_sorted(Attrs,
- [](const std::pair<unsigned, Attribute> &LHS,
- const std::pair<unsigned, Attribute> &RHS) {
- return LHS.first < RHS.first;
- }) &&
+ assert(llvm::is_sorted(Attrs, llvm::less_first()) &&
"Misordered Attributes list!");
assert(llvm::all_of(Attrs,
[](const std::pair<unsigned, Attribute> &Pair) {
if (Attrs.empty())
return {};
- assert(llvm::is_sorted(Attrs,
- [](const std::pair<unsigned, AttributeSet> &LHS,
- const std::pair<unsigned, AttributeSet> &RHS) {
- return LHS.first < RHS.first;
- }) &&
+ assert(llvm::is_sorted(Attrs, llvm::less_first()) &&
"Misordered Attributes list!");
assert(llvm::none_of(Attrs,
[](const std::pair<unsigned, AttributeSet> &Pair) {
}
}
- llvm::sort(Queue, [](const WriteOperation &LHS, const WriteOperation &RHS) {
- return LHS.first < RHS.first;
- });
+ llvm::sort(Queue, llvm::less_first());
for (auto WriteOp : Queue)
(this->*WriteOp.second)();
}
}
- llvm::sort(WriteQueue, [](const writeOperation &a, const writeOperation &b) {
- return a.first < b.first;
- });
+ llvm::sort(WriteQueue, llvm::less_first());
for (auto writeOp : WriteQueue) {
ZeroToOffset(OS, writeOp.first);
Entries.reserve(Symbols.getNumItems());
for (const auto &Sym : Symbols)
Entries.push_back(std::make_pair(Sym.getKey(), Sym.getValue()));
- llvm::sort(Entries, [](const Entry &LHS, const Entry &RHS) {
- return LHS.first < RHS.first;
- });
+ llvm::sort(Entries, llvm::less_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));
});
- sort(SetVec, [](const std::pair<unsigned, AttributeSet> &LHS,
- const std::pair<unsigned, AttributeSet> &RHS) {
- return LHS.first < RHS.first; // All values are unique.
- });
+ llvm::sort(SetVec, llvm::less_first()); // All values are unique.
return AttributeList::get(C, SetVec);
}