[cfe-dev] libclang interface for comments AST
Jacob Carlborg
doob at me.com
Mon Jul 16 23:46:22 PDT 2012
On 2012-07-16 21:48, Dmitri Gribenko wrote:
> Hello,
>
> I am designing a libclang interface to expose comments ASTs. Attached
> is a patch for Index.h.
>
> The API has node traversal APIs and APIs to get various properties of the nodes.
>
> I am not sure about error handling. For example,
> clang_InlineCommandComment_getCommandName is not applicable to a
> CXComment_Text AST node. I think that this should abort() right away,
> but I don't see any other libclang APIs doing that -- they try to
> return some bogus value instead.
>
> I just want to get some general feedback if this is the right
> direction and if there is something obviously missing.
This is awesome, just what I need.
About the error handling. It seems like most functions in libclang that
returns a string will just return an empty string when it can't return a
valid string.
BTW, why is CXComment a struct and not just a typedef? The rest of the
libclang API seems to use typedefs to void* when there's only a void*.
Some parts of the API, like CXString, uses structs but that's when they
also contain some extra data in addition to the void*.
If you're going with the struct use all lowercase for the variable
name(s) in the struct to be consistent with the rest of the API.
--
/Jacob Carlborg
More information about the cfe-dev
mailing list