summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd/index/Index.cpp
diff options
context:
space:
mode:
authorKirill Bobyrev <kbobyrev.opensource@gmail.com>2018-10-07 14:49:41 +0000
committerKirill Bobyrev <kbobyrev.opensource@gmail.com>2018-10-07 14:49:41 +0000
commit4a5ff88fdbd7d8646de3ec6ecfbc5fd1036dcb50 (patch)
treedc9c9316de08a813c32089fd07539d93b5c58db1 /clang-tools-extra/clangd/index/Index.cpp
parent01daf62a0dcfb46a69e96ddcae0711ac996801cd (diff)
downloadbcm5719-llvm-4a5ff88fdbd7d8646de3ec6ecfbc5fd1036dcb50.tar.gz
bcm5719-llvm-4a5ff88fdbd7d8646de3ec6ecfbc5fd1036dcb50.zip
[clangd] NFC: Migrate to LLVM STLExtras API where possible
This patch improves readability by migrating `std::function(ForwardIt start, ForwardIt end, ...)` to LLVM's STLExtras range-based equivalent `llvm::function(RangeT &&Range, ...)`. Similar change in Clang: D52576. Reviewed By: sammccall Differential Revision: https://reviews.llvm.org/D52650 llvm-svn: 343937
Diffstat (limited to 'clang-tools-extra/clangd/index/Index.cpp')
-rw-r--r--clang-tools-extra/clangd/index/Index.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/clang-tools-extra/clangd/index/Index.cpp b/clang-tools-extra/clangd/index/Index.cpp
index dec95fcf910..604927880a8 100644
--- a/clang-tools-extra/clangd/index/Index.cpp
+++ b/clang-tools-extra/clangd/index/Index.cpp
@@ -84,10 +84,8 @@ float quality(const Symbol &S) {
}
SymbolSlab::const_iterator SymbolSlab::find(const SymbolID &ID) const {
- auto It = std::lower_bound(Symbols.begin(), Symbols.end(), ID,
- [](const Symbol &S, const SymbolID &I) {
- return S.ID < I;
- });
+ auto It = llvm::lower_bound(
+ Symbols, ID, [](const Symbol &S, const SymbolID &I) { return S.ID < I; });
if (It != Symbols.end() && It->ID == ID)
return It;
return Symbols.end();
@@ -112,8 +110,8 @@ void SymbolSlab::Builder::insert(const Symbol &S) {
SymbolSlab SymbolSlab::Builder::build() && {
Symbols = {Symbols.begin(), Symbols.end()}; // Force shrink-to-fit.
// Sort symbols so the slab can binary search over them.
- std::sort(Symbols.begin(), Symbols.end(),
- [](const Symbol &L, const Symbol &R) { return L.ID < R.ID; });
+ llvm::sort(Symbols,
+ [](const Symbol &L, const Symbol &R) { return L.ID < R.ID; });
// We may have unused strings from overwritten symbols. Build a new arena.
BumpPtrAllocator NewArena;
llvm::UniqueStringSaver Strings(NewArena);
@@ -155,8 +153,8 @@ RefSlab RefSlab::Builder::build() && {
Result.reserve(Refs.size());
for (auto &Sym : Refs) {
auto &SymRefs = Sym.second;
- std::sort(SymRefs.begin(), SymRefs.end());
- // TODO: do we really need to dedup?
+ llvm::sort(SymRefs);
+ // FIXME: do we really need to dedup?
SymRefs.erase(std::unique(SymRefs.begin(), SymRefs.end()), SymRefs.end());
auto *Array = Arena.Allocate<Ref>(SymRefs.size());
OpenPOWER on IntegriCloud