justincady wrote:

> I tried with CMake project and this doesn't work for me. I tried in the 
> following way: [...]
> And I see two .idx files for each source file in .cache/clangd/index/ 
> directory (newly created and one which I copied from foobar

Hm. I tested again by downloading a fresh zlib and:

- Copy and extract the archive into two separate directories
- In each:
    - `$ cmake -S . -B build -DCMAKE_BUILD_TYPE=Release 
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON`
    - `$ cmake --build build/`
    - `$ mv build/compile_commands.json .`
- Open Client A in VSCode with this clangd config:
    - `--log=verbose`
    - `--background-index=true`
    - `--background-index-path-mappings=${workspaceFolder}=/BUILDTOKEN`
- Observe `.cache` is created and populated in Client A
    - `Enqueueing 17 commands for indexing`
- Copy `.cache` into Client B
    - `$ cp -R /path/to/zlib-one/zlib-1.3.1/.cache .`
- Open Client B in VSCode with the same clangd config
- Observe index is loaded and duplicate files are not created (both cache 
directories contain 29 files):

```
$ diff -bur .cache/ /path/to/zlib-one/zlib-1.3.1/.cache/`
$
```

- Now modify one file (adding an empty static function):

```
$ diff -bur .cache/ /path/to/zlib-one/zlib-1.3.1/.cache/
Binary files .cache/clangd/index/crc32.c.559185D1FE8F0292.idx and 
/path/to/zlib-one/zlib-1.3.1/.cache/clangd/index/crc32.c.559185D1FE8F0292.idx 
differ
$
```

There certainly could be a case I'm missing that's causing your error, but as 
far as I can tell this is working for me.

If we determine this is a viable path forward of course I will work to 
understand and resolve your issue. But if this direction is a dead end, we can 
focus on the preferred implementation.

https://github.com/llvm/llvm-project/pull/180285
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to