| Issue |
180821
|
| Summary |
[clangd] Changing compilation command in compile_commands.json doesn't lead to related file reindexing after clangd restart
|
| Labels |
clangd
|
| Assignees |
|
| Reporter |
ArcsinX
|
Steps to reproduce:
1) Create a sample project with only one source file `foo.c`
```cpp
#ifdef TEST
void foo() {
}
#endif
```
and `compile_commands.json`
```json
[
{
"directory": "/clangd_test/",
"command": "gcc -c /clangd_test/foo.c",
"file": "/clangd_test/foo.c"
}
]
```
2) After background indexing complete, `*.idx` file contains no symbols.
`$ dexp .cache/clangd/index/foo.c.32184AD94CF9C4CB.idx`
```
Loaded Dex from .cache/clangd/index/foo.c.32184AD94CF9C4CB.idx with estimated memory usage 248 bytes
- number of symbols: 0
- number of refs: 0
- number of relations: 0
```
3) Modify `compile_commands.json` and `-DTEST=1` argument
and `compile_commands.json`
```json
[
{
"directory": "/clangd_test/",
"command": "gcc -DTEST=1 -c /clangd_test/foo.c",
"file": "/clangd_test/foo.c"
}
]
```
4) Restart clangd
After that, clangd doesn't reindex `foo.c` and *.idx file still contains no symbols
If `foo.c` is modified somehow, it will be reindexed with the new compile command after clangd restart and *.idx file will contain 1 symbol
It seems this functionality doesn't work from the introduction: https://github.com/llvm/llvm-project/commit/11e1c50b08baa8c0f1a220076bd38aff40eb6617
We only read/write compile command, but don't use iе when deciding whether to reindex the source file or not
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs