[PATCH] D54529: [clangd] Add USR to textDocument/definition response

Jan Korous via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 14 08:06:31 PST 2018


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

We need a way for given code position to get the best definition/declaration location in given translation unit and it's USR.

Since the first element in list returned by textDocument/definition is meeting the def/decl location requirement we'd just need to add the USR. Other option would be to split this to a separate method. I thought this patch to be a better fit from protocol perspective but I am happy to go the other way if that's preferred.

I'd like to ask if someone more familiar with gtest matchers could take a look at changes I made in unit-tests. I am not sure it's exactly the idiomatic way. I was trying to use Property() matchers first but gave up since I wasn't able to debug it (got lost in template error messages).


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D54529

Files:
  ClangdLSPServer.cpp
  ClangdLSPServer.h
  ClangdServer.cpp
  ClangdServer.h
  Protocol.cpp
  Protocol.h
  XRefs.cpp
  XRefs.h
  clangd/ClangdTests.cpp
  clangd/SyncAPI.cpp
  clangd/SyncAPI.h
  clangd/XRefsTests.cpp
  clangd/textdocument-didchange-fail.test
  clangd/xrefs.test

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54529.174040.patch
Type: text/x-patch
Size: 23307 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181114/e144e63c/attachment-0001.bin>


More information about the cfe-commits mailing list