[cfe-dev] libclang interface for comments AST

Dmitri Gribenko gribozavr at gmail.com
Tue Jul 17 13:35:23 PDT 2012


On Tue, Jul 17, 2012 at 12:01 PM, Jacob Carlborg <doob at me.com> wrote:
> On 2012-07-17 18:54, Douglas Gregor wrote:
>
>> This group of functions:
>>
>> +CINDEX_LINKAGE CXString clang_HTMLTagComment_getTagName(CXComment Comment);
>> +CINDEX_LINKAGE
>> +unsigned clang_HTMLStartTagComment_isSelfClosing(CXComment Comment);
>> +CINDEX_LINKAGE unsigned clang_HTMLStartTag_getNumAttrs(CXComment Comment);
>> +CINDEX_LINKAGE
>> +CXString clang_HTMLStartTag_getAttrName(CXComment Comment, unsigned AttrIdx);
>> +CINDEX_LINKAGE
>> +CXString clang_HTMLStartTag_getAttrValue(CXComment Comment, unsigned AttrIdx);
>>
>> implies that a client will have to reconstruct HTML tags on its own, which seems like it's going to cause a lot of redundant (and probably wrong) code in clients. Can the aforementioned clang_Comment_getText() do the right thing for CXComment_HTMLStartTag and CXComment_HTMLEndTag nodes, by formatting the HTML tag appropriately? That would simplify a number of clients.
>
> I don't agree with this. Isn't the job of libclang to just provide the
> data and then it's up to the client what to do with it?
>
> I wouldn't want to get HTML back, I'm just interested in the data. I
> have other plans for the data than transforming it to HTML.
>
> What about providing API for doing both?

Sure, both APIs should be available.

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