The RefKind being 9 vs. 12 is expected, that just identifies the occurrence in the header file as being the declaration (9 is Declaration | Spelled from these flags) vs. the occurrences in the source files as being references (12 is Reference | Spelled).
It’s hard to diagnose the issue without being able to reproduce it, but a few theories:
- The
.hextension is ambiguous between C and C++, is clangd parsing the header file in C++ mode? In C mode function signatures are mangled differently and the same signature can produce a differentID. - Presumably, the header file does not have its own entry in
compile_commands.json, so when you open it in the editor, clangd infers the compile command for it from another file. Which file is that? (Search for “inferred from” in the clangd logs.) Is it one of the source files that contains references to the function? If not, can you try adding a reference to the function in that source file, and see if find-refs on the reference in that source file finds the other references?