This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Perform merge for main file symbols.
ClosedPublic

Authored by hokein on Jun 17 2019, 5:51 AM.

Details

Summary

Previously, we randomly pick one main file symbol in dynamic index, we
may loose the ideal symbol (with definition location) in the index.

It fixes the issue where sometimes we fail to go to the symbol definition, see:

  1. call go-to-decl on Foo in Foo.cpp
  2. jump to Foo.h, call go-to-def on Foo in Foo.h

we can't go back to Foo.cpp -- because we open Foo.cpp, Foo.h in clangd, both
files have Foo symbol (one with def&decl, one with decl only), we randomely
choose one.

Diff Detail

Repository
rL LLVM

Event Timeline

hokein created this revision.Jun 17 2019, 5:51 AM

We also make use of PickOne in updatePreamble shouldn't that also cause similar troubles?

kadircet accepted this revision.Jun 17 2019, 6:33 AM
This revision is now accepted and ready to land.Jun 17 2019, 6:33 AM

We also make use of PickOne in updatePreamble shouldn't that also cause similar troubles?

Yeah, we have similar problems in updatePreamble, but this is a correctness/performance tradeoff -- we have a large number of symbols in preamble, the cost of merging is too high.

However the number of main file symbols is relatively small (e.g. Sema.cpp only has 99 symbols), the cost is not too high.

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJun 17 2019, 7:46 AM