[PATCH] D53317: [clangd] Allow disble down traversals from root.
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 16 03:23:07 PDT 2018
sammccall accepted this revision.
sammccall added a comment.
This revision is now accepted and ready to land.
Works for me! I think the code can be simplified slightly.
================
Comment at: clangd/FileDistance.cpp:135
}
+ if ((KnownNode == RootHash) && !Opts.AllowDownTraversalFromRoot)
+ return Ancestors.empty() ? Cost : Unreachable;
----------------
I think this is more power than it needs to be... and in fact messes up the caching.
```
if (KnownNode == RootHash && !Opts.AllowDownTraversalFromRoot && !Ancestors.empty())
Cost = Unreachable;
```
should be enough.
Or maybe even clearer, after line 126:
```
if (Hash == RootHash && !Ancestors.empty() && !Opts.AllowDownTraversalFromRoot) {
Cost = Unreachable;
break;
}
```
then you never have to store KnownNode.
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D53317
More information about the cfe-commits
mailing list