[cfe-commits] [PATCH] Add Python bindings to comment AST introspection APIs

Douglas Gregor dgregor at apple.com
Fri Dec 21 11:15:00 PST 2012


On Dec 21, 2012, at 10:30 AM, Ben Gertzfield <bgertzfield at gmail.com> wrote:

> On Fri, Dec 21, 2012 at 10:12 AM, Douglas Gregor <dgregor at apple.com> wrote:
> clang_findReferencesInFile.
> 
> Got it. I found functions like this to be very handy in my Python unit tests as well.

I should probably have said more, because clang_findReferencesInFile is a good example of something that can be implemented with the CXCursor interface, but it's surprisingly hard to get right, and users that tried ended up with poor versions of the feature. But clang_findReferencesInFile gets the details right, and will be updated as the underlying C++ ASTs change, so users of that interface get more accurate results with less work. Oh, and it performs way better, too, because it can use the richer C++ ASTs to optimize its traversal.

> Perhaps optionally building on a comment cursor API foundation, we could provide stable high-level APIs like this to find all the comments in a file, or all the comment nodes of a particular type in a comment, etc.

We could. The question is whether there are clients that would really benefit from this work, or whether we'd be better off making the high-level API that much better.

	- Doug

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20121221/49d4f598/attachment.html>


More information about the cfe-commits mailing list