[cfe-dev] Identifying Cursors from included files.

Peter Conn conn.peter at gmail.com
Sat Jan 5 02:23:18 PST 2013


Hello

When I'm looking through cursors using 'clang_visitChildren', how do I
check whether that cursor comes from an included file.

I have tried:
CXFile cxf;
clang_getSpellingLocation(clang_getRangeStart(clang_getCursorExtent(cursor),
&cxf, NULL, NULL, NULL);

But clang_getCString(clang_getFileName(cxf)) will always return the name of
the main file.

I have also tried:
getTranslationUnitSpelling(clang_Cursor_getTranslationUnit(cursor))

and the same applies here.

I would like to be able to distinguish between cursors that are present in
the original file, and those from included files.

Thanks, Peter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130105/010ec5fa/attachment.html>


More information about the cfe-dev mailing list