HighCommander4 wrote:
I built this patch locally and tried it on a real-world project, and I think we
may be missing a piece of the implementation, though I'm not sure what it is
yet.
Here's what I'm seeing. Given the following files:
header.hpp:
```c++
#include <memory>
struct Waldo {
Waldo(int location);
};
```
test.cpp:
```c++
#include "header.hpp"
int main() {
std::make_unique<Waldo>(42);
}
```
and a `compile_commands.json` file that contains an entry for `test.cpp`, I
observe the following:
* Open either source file to give the background indexer the chance to build
the project's (on-disk) index
* Open `header.hpp` and close `test.cpp` if open
* Restart clangd. Since only `header.hpp` is open, the contents of `test.cpp`
are present only in the background index, not the dynamic (in-memory) index.
* Perform find-refs on the `Waldo` constructor. **The reference in test.cpp is
not found.**
* Now open `test.cpp`, so its contents are also added to the dynamic index.
* Perform find-refs on the `Waldo` constructor. **The reference is test.cpp
now IS found.**
@timon-ul, do you see this behaviour as well?
The observations suggest that somehow, our feature is working in the dynamic
index but not in the background index. This surprises me as they should both be
using SymbolCollector is ~the same way.
Note also that the issue is specific to our feature: if you do the same thing
but invoke find-refs on the **class** `Waldo` (rather than the constructor),
now the reference in `test.cpp` is found even before `test.cpp` is opened,
suggesting that that reference is correctly being found in the background index.
https://github.com/llvm/llvm-project/pull/169742
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits