[PATCH] D67916: [clangd] Simplify the callside of URI::resolve, NFC.

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 23 07:10:57 PDT 2019


kadircet accepted this revision.
kadircet added a comment.
This revision is now accepted and ready to land.

LGTM, thanks!



================
Comment at: clang-tools-extra/clangd/FindSymbols.cpp:48
   if (!Path) {
     return llvm::make_error<llvm::StringError>(
+        formatv("Could not resolve path for URI '{0}' for symbol '{1}': {2}",
----------------
`return make_string_error(...` ?

Also the error string regarding `CD.FileURI` should be contained in `Path.takeError` maybe just print:
`Could not resolve path for symbol '{0}': {1}, Sym.Name, Path.takeError()` ?


================
Comment at: clang-tools-extra/clangd/URI.cpp:190
+  if (!Uri)
+    return make_string_error(llvm::toString(Uri.takeError()));
+  auto Path = URI::resolve(*Uri, HintPath);
----------------
why not just `Uri.takeError` ?

same below for `Path.takeError`


================
Comment at: clang-tools-extra/clangd/URI.h:66
 
+  /// Resolves the absolute path of a URI string.
+  static llvm::Expected<std::string> resolve(llvm::StringRef FileURI,
----------------
what about:

```
Same as above, in addition parses \p FileURI using URI::parse to create a URI.
```


================
Comment at: clang-tools-extra/clangd/index/BackgroundIndexLoader.cpp:30
+  if (!AbsolutePath) {
+    elog("Failed to resolve URI {0}:", URI, AbsolutePath.takeError());
     return llvm::None;
----------------
wow, thanks for catching this one.

`Failed to resolve URI {0}: {1}`


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67916/new/

https://reviews.llvm.org/D67916





More information about the cfe-commits mailing list