diff options
Diffstat (limited to 'clangd/index/dex/PostingList.cpp')
-rw-r--r-- | clangd/index/dex/PostingList.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/clangd/index/dex/PostingList.cpp b/clangd/index/dex/PostingList.cpp index eb2e4757..67ed070a 100644 --- a/clangd/index/dex/PostingList.cpp +++ b/clangd/index/dex/PostingList.cpp @@ -1,15 +1,15 @@ //===--- PostingList.cpp - Symbol identifiers storage interface -----------===// // -// The LLVM Compiler Infrastructure -// -// 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 // //===----------------------------------------------------------------------===// #include "PostingList.h" #include "Iterator.h" #include "Token.h" +#include "llvm/ADT/STLExtras.h" #include "llvm/Support/Error.h" #include "llvm/Support/MathExtras.h" @@ -50,7 +50,8 @@ public: return; advanceToChunk(ID); // Try to find ID within current chunk. - CurrentID = std::lower_bound(CurrentID, std::end(DecompressedChunk), ID); + CurrentID = llvm::bsearch(CurrentID, DecompressedChunk.end(), + [&](const DocID D) { return D >= ID; }); normalizeCursor(); } @@ -101,10 +102,9 @@ private: void advanceToChunk(DocID ID) { if ((CurrentChunk != Chunks.end() - 1) && ((CurrentChunk + 1)->Head <= ID)) { - // Find the next chunk with Head >= ID. - CurrentChunk = std::lower_bound( - CurrentChunk + 1, Chunks.end(), ID, - [](const Chunk &C, const DocID ID) { return C.Head <= ID; }); + CurrentChunk = + llvm::bsearch(CurrentChunk + 1, Chunks.end(), + [&](const Chunk &C) { return C.Head >= ID; }); --CurrentChunk; DecompressedChunk = CurrentChunk->decompress(); CurrentID = DecompressedChunk.begin(); |