r364720 - Cleanup: llvm::bsearch -> llvm::partition_point after r364719
Fangrui Song via cfe-commits
cfe-commits at lists.llvm.org
Sun Jun 30 04:19:56 PDT 2019
Author: maskray
Date: Sun Jun 30 04:19:56 2019
New Revision: 364720
URL: http://llvm.org/viewvc/llvm-project?rev=364720&view=rev
Log:
Cleanup: llvm::bsearch -> llvm::partition_point after r364719
Modified:
cfe/trunk/lib/Tooling/Syntax/Tokens.cpp
Modified: cfe/trunk/lib/Tooling/Syntax/Tokens.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/Syntax/Tokens.cpp?rev=364720&r1=364719&r2=364720&view=diff
==============================================================================
--- cfe/trunk/lib/Tooling/Syntax/Tokens.cpp (original)
+++ cfe/trunk/lib/Tooling/Syntax/Tokens.cpp Sun Jun 30 04:19:56 2019
@@ -127,8 +127,8 @@ TokenBuffer::spelledForExpandedToken(con
unsigned ExpandedIndex = Expanded - ExpandedTokens.data();
// Find the first mapping that produced tokens after \p Expanded.
- auto It = llvm::bsearch(File.Mappings, [&](const Mapping &M) {
- return ExpandedIndex < M.BeginExpanded;
+ auto It = llvm::partition_point(File.Mappings, [&](const Mapping &M) {
+ return M.BeginExpanded <= ExpandedIndex;
});
// Our token could only be produced by the previous mapping.
if (It == File.Mappings.begin()) {
@@ -212,8 +212,8 @@ TokenBuffer::expansionStartingAt(const s
Spelled < (File.SpelledTokens.data() + File.SpelledTokens.size()));
unsigned SpelledIndex = Spelled - File.SpelledTokens.data();
- auto M = llvm::bsearch(File.Mappings, [&](const Mapping &M) {
- return SpelledIndex <= M.BeginSpelled;
+ auto M = llvm::partition_point(File.Mappings, [&](const Mapping &M) {
+ return M.BeginSpelled < SpelledIndex;
});
if (M == File.Mappings.end() || M->BeginSpelled != SpelledIndex)
return llvm::None;
More information about the cfe-commits
mailing list