This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by hokein on Sep 23 2019, 6:42 AM.

Details

Summary
  • Add a overrloded URI::resolve, which accepts a string URI;
  • also fixed some callside that don't check the error;

Event Timeline

hokein created this revision.Sep 23 2019, 6:42 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 23 2019, 6:42 AM
hokein updated this revision to Diff 221320.Sep 23 2019, 6:44 AM

remove an accident change.

kadircet accepted this revision.Sep 23 2019, 7:09 AM

LGTM, thanks!

clang-tools-extra/clangd/FindSymbols.cpp
48–49

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() ?

clang-tools-extra/clangd/URI.cpp
190

why not just Uri.takeError ?

same below for Path.takeError

clang-tools-extra/clangd/URI.h
66

what about:

Same as above, in addition parses \p FileURI using URI::parse to create a URI.
clang-tools-extra/clangd/index/BackgroundIndexLoader.cpp
30

wow, thanks for catching this one.

Failed to resolve URI {0}: {1}

This revision is now accepted and ready to land.Sep 23 2019, 7:09 AM
kadircet requested changes to this revision.Sep 23 2019, 7:10 AM
kadircet added inline comments.
clang-tools-extra/clangd/index/BackgroundIndexLoader.cpp
30

actually can you just inline this into call site?

This revision now requires changes to proceed.Sep 23 2019, 7:10 AM
hokein updated this revision to Diff 221326.Sep 23 2019, 7:26 AM
hokein marked 7 inline comments as done.

address comments.

hokein added inline comments.Sep 23 2019, 7:26 AM
clang-tools-extra/clangd/FindSymbols.cpp
48–49

make_string_error is an internal helper in URI.cpp only.

clang-tools-extra/clangd/URI.cpp
190

good point. The code was changed back and forth a few times.

kadircet accepted this revision.Sep 23 2019, 7:32 AM

LGTM, thanks!

clang-tools-extra/clangd/FindSymbols.cpp
48–49

ah I see, when I searched for make_string_error, there were too many references so I assumed it was a generic helper, but apparently every file has an internal implementation ...

Whatever that can be an adventure for another day...

This revision is now accepted and ready to land.Sep 23 2019, 7:32 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptSep 23 2019, 7:37 AM