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
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits