[clangd] Collect references for externally visible main-file symbols
authorAleksandr Platonov <platonov.aleksandr@huawei.com>
Mon, 27 Jul 2020 11:39:31 +0000 (14:39 +0300)
committerAleksandr Platonov <platonov.aleksandr@huawei.com>
Mon, 27 Jul 2020 12:35:53 +0000 (15:35 +0300)
commit90684d1545167ee4e0c93d8eaf6ba4a3c7ab710e
tree904b8fb14a68766ab7174d5b70bd70f8c2cea21d
parentdb203e0268479d16d36a318c726cce5a4a5f75a6
[clangd] Collect references for externally visible main-file symbols

Summary:
Without this patch clangd does not collect references for main-file symbols if there is no public declaration in preamble.
Example:
`test1.c`
```
void f1() {}
```

`test2.c`
```
extern void f1();
void f2() {
  f^1();
}
```
`Find all references` does not show definition of f1() in the result, but GTD works OK.

Reviewers: sammccall, kadircet

Reviewed By: kadircet

Subscribers: ilya-golovenko, ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D84513
clang-tools-extra/clangd/index/SymbolCollector.cpp
clang-tools-extra/clangd/unittests/BackgroundIndexTests.cpp
clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp