[clang-tools-extra] r336242 - [clangd] FileDistance: don't add duplicate edges
Sam McCall via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 4 01:27:29 PDT 2018
Author: sammccall
Date: Wed Jul 4 01:27:28 2018
New Revision: 336242
URL: http://llvm.org/viewvc/llvm-project?rev=336242&view=rev
Log:
[clangd] FileDistance: don't add duplicate edges
Modified:
clang-tools-extra/trunk/clangd/FileDistance.cpp
Modified: clang-tools-extra/trunk/clangd/FileDistance.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/FileDistance.cpp?rev=336242&r1=336241&r2=336242&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/FileDistance.cpp (original)
+++ clang-tools-extra/trunk/clangd/FileDistance.cpp Wed Jul 4 01:27:28 2018
@@ -72,7 +72,9 @@ FileDistance::FileDistance(StringMap<Sou
for (unsigned I = 0; !Rest.empty(); ++I) {
Rest = parent_path(Rest, sys::path::Style::posix);
auto NextHash = hash_value(Rest);
- DownEdges[NextHash].push_back(Hash);
+ auto &Down = DownEdges[NextHash];
+ if (std::find(Down.begin(), Down.end(), Hash) == Down.end())
+ DownEdges[NextHash].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())
More information about the cfe-commits
mailing list