[cfe-dev] clang_getCursorUSR : reverse?

Douglas Gregor dgregor at apple.com
Tue Jan 25 07:51:01 PST 2011


On Jan 24, 2011, at 8:53 PM, Michael Mullin wrote:

> Hello
> 
> I might be misunderstanding clang_getCursorUSR.  I believe it's purpose is to facilitate comparing entities across translation units, but Im not quite sure how to exactly go about the comparison.
> 
> Is the client program supposed to recursively descend (visitChildren) the second translation unit, testing clang_getCursorUSR on each cursor against the cursor from the first translation unit it wants to find?

Yes, that's one way. The assumption that libclang makes is that there is some external database that will help perform mappings across 

> is there a way to keep this functionality "inside" the libclang api rather than have the client be responsible for it?
> 
> eg
> since there is a function
> CXString clang_getCursorUSR( CXCursor );
> 
> should there be a function
> 
> CXCursor clang_getCursorFromUSR( CXString );
> 
> ??


I think that would make a great addition. It's going to require writing the equivalent of a demangler for USRs (mapping from USRs to entity names and such) along with a localized search to find matching USRs, but it would be really useful.

	- Doug
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110125/d58f4253/attachment.html>


More information about the cfe-dev mailing list