Search code examples
autocompleteclangctags

Can clang's c-index-test also find the declaration of a symbol?


I have found an older question about a similar topic, but I am still wondering how to do this: I'd like to try to use clang for code navigation, instead of gtags / GNU global or similar tools. I am already using autocomplete-clang for Emacs, which works really well. But it does only completion. Now I would like to ask clang: "Where is the definition and / or declaration of the symbol in xyz.cc:42:23". Is this possible with either c-index-test or clang?


Solution

  • Clang definitely knows where is the definition of the symbol. I switched from clang-autocomplete to clang-autocomplete-async which uses clang-complete tool built on top of clang instead of stock clang. Although this tool does not support navigation yet, I believe it would be possible to implement it quite easily.