[cfe-dev] libclang documentation/comments API

Ben Jackson via cfe-dev cfe-dev at lists.llvm.org
Sun Sep 6 09:54:01 PDT 2015


Hi there,

I’m working on a feature for querying and returning documentation data in a libclang-based code comprehension engine (ycmd - https://github.com/Valloric/ycmd <https://github.com/Valloric/ycmd> ). The idea is, for a given cursor, return meaningful documentation for display to a user in their IDE (i.e. “What is the doxygen documentation for the method under my cursor?” ).

I have found that there is quite rich support for doxygen comment parsing within clang, and most (all?) of it is exposed in libclang. This is awesome! Thanks!

However, I do have a few questions about the current level of support:

1. The “comment introspection” API is not listed (here: http://clang.llvm.org/doxygen/modules.html <http://clang.llvm.org/doxygen/modules.html>) as part of “libclang”. Does that mean that the API is not public or not stable in some way? The docs say “These facilities are distinct from the core and may be subject to their own schedule of stability and deprecation”… I’m just curious as to how much this is likely to be an issue?

2. Is there any way via libclang to get the raw text, or any other pretty-printed text,  of a particular declaration? The idea here is that I could present the declaration text, followed by its brief and any other documentation. The declaration text itself is probably the most useful documentation for a developer :).Currently I am actually getting this by calling clang_FullComment_getAsXML() and parsing the output to get the “<Declaration>” element, but that seems painfully wasteful.

3. I guess finally, do you have any other thoughts or has anyone approached this before or know of an implementation doing this sort of thing, etc. Any feedback would be greatly appreciated. :) If anyone is interested, a quick demo is here: http://www.gfycat.com/AlertNarrowAntelopegroundsquirrel <http://www.gfycat.com/AlertNarrowAntelopegroundsquirrel>

Many thanks,
Ben

P.S. Apologies if this list is not for this sort of query :/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150906/65d5a1df/attachment.html>


More information about the cfe-dev mailing list