[cfe-dev] Range for CXFile

Milian Wolff mail at milianw.de
Mon Jan 12 02:53:09 PST 2015


On Saturday 10 January 2015 21:47:48 Jacob Carlborg wrote:
> On 2015-01-10 21:32, Milian Wolff wrote:
> > Yes, for nodes/cursors that is true. But comments don't have a cursor, do
> > they? So I need to tokenize the include files separately. Which is
> > apparently not possible currently - if I understand you correctly?
> 
> Ok, I see the problem now. Yeah, it doesn't look like comments will have
> a cursor. I really don't know, I'm not so familar with libclang tokenize
> API.
> 
> I found this [1], don't know if it's related.
>
> [1]
> https://github.com/llvm-mirror/clang/blob/da5bcf310ea7bff05a15b8650034774016
> bea7a3/tools/libclang/CIndex.cpp#L5350-L5352

It just says that I cannot pass a range that spans multiple files. I don't 
want/need that. Rather, I want to find the range for an included file and pass 
that to the tokenizer. Then, the CXFile / FileID should be equal for the begin 
and end range, and the tokenizer should work - or so I hope. I just have 
trouble constructing the range for a given CXFile... :)

Anyhow, maybe someone else has an idea how to do that. Constructing the start 
cursor for a file is trivial. Maybe I should try to create a huge end cursor 
and see whether the tokenizer can work with that...

Cheers
-- 
Milian Wolff
mail at milianw.de
http://milianw.de



More information about the cfe-dev mailing list