[PATCH] D48687: [clangd] Avoid duplicates in findDefinitions response

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 3 09:13:45 PDT 2018


hokein added a comment.

After taking a look closely, I figured why there are two candidates here -- one is from AST (the one with ".." path); the other one is from dynamic index, the deduplication failed because of the different paths :(

I think the fixing way is to normalize the file path from AST (making it absolute).

> +1 to sharing the code. I guess we're struggling with similar problems here. Any pointers to the functions we should use?

Yeah, we struggled this problem in SymbolCollector. We cleanup the file path manually. I'd suggest abstract that logic from `toURI` (https://github.com/llvm-mirror/clang-tools-extra/blob/master/clangd/index/SymbolCollector.cpp#L80), and use it here.

> I tried to make it as close as possible to the example in the bug report, but don't manage to reproduce the bug.

To reproduce the issue, I think you'd also need to enable the dynamic index.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D48687





More information about the cfe-commits mailing list