[cfe-dev] libclang interface for comments AST

Dmitri Gribenko gribozavr at gmail.com
Tue Jul 17 09:45:20 PDT 2012


Hi Jacob!

Thank you for reviewing!

On Mon, Jul 16, 2012 at 11:46 PM, Jacob Carlborg <doob at me.com> wrote:
> 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.

I agree that it is easy to make up a string with an empty value.  But
what about clang_ParamCommandComment_getDirection, for example?  There
is no "neutral" parameter passing direction.

> 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*.

The design is not final (and the API is not fully implemented), so I
didn't know if I will need anything else except void *Data.

> 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.

The API is inconsistent in itself: struct CXUnsavedFile, struct
CXVersion have members starting with uppercase letter, some other
structs use lowercase.  Of these two styles I followed general clang
style (which is a better thing to do).

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/



More information about the cfe-dev mailing list