Skip to content

Commit b296386

Browse files
[llvm] Use llvm::equal (NFC) (llvm#169173)
While I am at it, this patch uses const l-value references for std::shared_ptr. We don't need to increment the reference count by passing std::shared_ptr by value. Identified with llvm-use-ranges.
1 parent 637299e commit b296386

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

llvm/lib/CodeGen/CallingConvLower.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,5 @@ bool CCState::resultsCompatible(CallingConv::ID CalleeCC,
290290
llvm_unreachable("Unknown location kind");
291291
};
292292

293-
return std::equal(RVLocs1.begin(), RVLocs1.end(), RVLocs2.begin(),
294-
RVLocs2.end(), AreCompatible);
293+
return llvm::equal(RVLocs1, RVLocs2, AreCompatible);
295294
}

llvm/lib/TextAPI/InterfaceFile.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -421,12 +421,11 @@ bool InterfaceFile::operator==(const InterfaceFile &O) const {
421421
return false;
422422
}
423423

424-
if (!std::equal(Documents.begin(), Documents.end(), O.Documents.begin(),
425-
O.Documents.end(),
426-
[](const std::shared_ptr<InterfaceFile> LHS,
427-
const std::shared_ptr<InterfaceFile> RHS) {
428-
return *LHS == *RHS;
429-
}))
424+
if (!llvm::equal(Documents, O.Documents,
425+
[](const std::shared_ptr<InterfaceFile> &LHS,
426+
const std::shared_ptr<InterfaceFile> &RHS) {
427+
return *LHS == *RHS;
428+
}))
430429
return false;
431430
return true;
432431
}

0 commit comments

Comments
 (0)