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

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 23 07:27:06 PDT 2019


hokein added inline comments.


================
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}",
----------------
kadircet wrote:
> `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()` ?
`make_string_error` is an internal helper in `URI.cpp` only.


================
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);
----------------
kadircet wrote:
> why not just `Uri.takeError` ?
> 
> same below for `Path.takeError`
good point. The code was changed back and forth a few times.


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