[cfe-dev] libclang interface for comments AST

Douglas Gregor dgregor at apple.com
Tue Jul 17 13:46:53 PDT 2012


On Jul 17, 2012, at 1:34 PM, Dmitri Gribenko <gribozavr at gmail.com> wrote:

> On Tue, Jul 17, 2012 at 11:35 AM, Douglas Gregor <dgregor at apple.com> wrote:
>> 
>> I generally prefer fewer entry points, so that clients that have to switch() on all of the enum values can at the very least combine cases for obvious things (say, if they don't care about adding special formatting for HTML or other inlines). The general philosophy I have is that simple clients should be able to do simple things, but the information should be there to do more complicated things.
>> 
>> But, I completely see your point about this potentially causing confusion with the API, and we have seen some confusion with other libclang APIs that skew toward fewer, more general entry points. We can try it your way :)
> 
> Don't get me wrong, I see how a general getText() call is a useful
> API.  But I think it would be better if it would be a separate API
> call (for example, getAsPlainText()) that is designed (and expected by
> users) to do all the required magic.  I see these various *_getText()
> APIs as property getters for specific node kinds, low-level building
> blocks without any magic to facilitate building other tools on top of
> libclang (for example, implement some other way to convert a comment
> to plain text).

Okay, that makes sense. I don't think we need to do getAsPlainText() now.

	- Doug



More information about the cfe-dev mailing list