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) {}


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) {}
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to