clang-tags icon indicating copy to clipboard operation
clang-tags copied to clipboard

clang-tags database does not identify definitions

Open nrnrnr opened this issue 9 years ago • 3 comments

I'm finding the clang-tags sqlite database incredibly useful for my project, but it would be even more useful if a new column were added to the tags table, containing the results of the libclang API call

CINDEX_LINKAGE unsigned     clang_isCursorDefinition (CXCursor)

If there could be an isDefn column along with the isDecl column, that would be awesome.

I am willing to try to help make this happen with a fork and a pull request, but although I am a decent C programmer, my C++ skills are minimal. Can you give any guidance? What's a good way to proceed?

nrnrnr avatar Dec 06 '15 18:12 nrnrnr

I guess a good way to go would be to follow the same path as isDecl, which is very similar:

  1. in cursor.[hc]xx, add a new Cursor::isDefinition member function, whose definition can be inspired from Cursor::isDeclaration
  2. In storage.cxx, change the table structure to add the desired column, and modify the two addTag functions to accept another argument isDefn.
  3. in update.cxx, update the call to storage_.addTag to include the extra argument.

Please don't hesitate to tell me if you encounter difficulties ; I can also try to find some time to work on it...

ffevotte avatar Dec 06 '15 21:12 ffevotte

I'll give it a try. Possibly this week, possibly next---it depends how writing goes.

nrnrnr avatar Dec 06 '15 21:12 nrnrnr

I've tried your suggestion, and it works! Minor difficulty ensues if the new clang-tags server sees an old database.

I've submitted a pull request.

nrnrnr avatar Dec 08 '15 01:12 nrnrnr