[clang-tools-extra] r343946 - [clangd] Migrate to LLVM STLExtras range API
Fangrui Song via cfe-commits
cfe-commits at lists.llvm.org
Sun Oct 7 10:21:08 PDT 2018
Author: maskray
Date: Sun Oct 7 10:21:08 2018
New Revision: 343946
URL: http://llvm.org/viewvc/llvm-project?rev=343946&view=rev
Log:
[clangd] Migrate to LLVM STLExtras range API
Modified:
clang-tools-extra/trunk/clangd/FileDistance.cpp
clang-tools-extra/trunk/clangd/XRefs.cpp
Modified: clang-tools-extra/trunk/clangd/FileDistance.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/FileDistance.cpp?rev=343946&r1=343945&r2=343946&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/FileDistance.cpp (original)
+++ clang-tools-extra/trunk/clangd/FileDistance.cpp Sun Oct 7 10:21:08 2018
@@ -72,8 +72,8 @@ FileDistance::FileDistance(StringMap<Sou
Rest = parent_path(Rest, sys::path::Style::posix);
auto NextHash = hash_value(Rest);
auto &Down = DownEdges[NextHash];
- if (std::find(Down.begin(), Down.end(), Hash) == Down.end())
- DownEdges[NextHash].push_back(Hash);
+ if (!llvm::is_contained(Down, Hash))
+ Down.push_back(Hash);
// We can't just break after MaxUpTraversals, must still set DownEdges.
if (I > S.getValue().MaxUpTraversals) {
if (Cache.find(Hash) != Cache.end())
Modified: clang-tools-extra/trunk/clangd/XRefs.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/XRefs.cpp?rev=343946&r1=343945&r2=343946&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/XRefs.cpp (original)
+++ clang-tools-extra/trunk/clangd/XRefs.cpp Sun Oct 7 10:21:08 2018
@@ -372,11 +372,10 @@ public:
}
std::vector<Reference> take() && {
- std::sort(References.begin(), References.end(),
- [](const Reference &L, const Reference &R) {
- return std::tie(L.Loc, L.CanonicalTarget, L.Role) <
- std::tie(R.Loc, R.CanonicalTarget, R.Role);
- });
+ llvm::sort(References, [](const Reference &L, const Reference &R) {
+ return std::tie(L.Loc, L.CanonicalTarget, L.Role) <
+ std::tie(R.Loc, R.CanonicalTarget, R.Role);
+ });
// We sometimes see duplicates when parts of the AST get traversed twice.
References.erase(
std::unique(References.begin(), References.end(),
More information about the cfe-commits
mailing list