[PATCH] D51691: [clangd] NFC: Document URIDistance

Kirill Bobyrev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 5 10:22:44 PDT 2018


kbobyrev created this revision.
kbobyrev added reviewers: sammccall, ioeric, ilya-biryukov.
kbobyrev added a project: clang-tools-extra.
Herald added subscribers: kadircet, arphaman, jkorous, MaskRay.

`URIDistance` constructor should mention that `Sources` must contain *absolute paths*, not URIs. This is not very clear when looking at the interface, especially given that `distance(...)` accepts `URI`, not an absolute path which can give the wrong impression.


https://reviews.llvm.org/D51691

Files:
  clang-tools-extra/clangd/FileDistance.h


Index: clang-tools-extra/clangd/FileDistance.h
===================================================================
--- clang-tools-extra/clangd/FileDistance.h
+++ clang-tools-extra/clangd/FileDistance.h
@@ -63,7 +63,7 @@
 };
 
 // Supports lookups to find the minimum distance to a file from any source.
-// This object should be reused, it memoizes intermediate computations.
+// This object should be reused, it memorizes intermediate computations.
 class FileDistance {
 public:
   static constexpr unsigned Unreachable = std::numeric_limits<unsigned>::max();
@@ -86,6 +86,8 @@
 // comparison on the bodies.
 class URIDistance {
 public:
+  // Memorizes paths from \p Sources and builds efficient structure for URI
+  // distance computations. \p Sources must contain absolute paths, not URIs.
   URIDistance(llvm::StringMap<SourceParams> Sources,
               const FileDistanceOptions &Opts = {})
       : Sources(Sources), Opts(Opts) {}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51691.164066.patch
Type: text/x-patch
Size: 945 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180905/e43555e2/attachment.bin>


More information about the cfe-commits mailing list