[cfe-dev] Range for CXFile

Milian Wolff mail at milianw.de
Fri Jan 9 07:48:27 PST 2015


Hello all,

in the clang-c API, one can find the range for the top-level file of a 
translation unit via

auto cursor = clang_getTranslationUnitCursor(unit);
auto range = clang_getCursorExtent(cursor);

Cool. But, now, I have a CXFile representing a file that was included at some 
point within the TU. How do I get its range?

Or maybe there is a different way: I want to access all comments in any CXFile 
encountered in a translation unit. Currently, we tokenize the top-level 
document and then look for the CXToken_Comment tokens and get their spelling 
and range. 

I cannot find a way to do the same for included files. Help would be 
appreciated.

Thanks!
-- 
Milian Wolff
mail at milianw.de
http://milianw.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150109/deb4762f/attachment.sig>


More information about the cfe-dev mailing list