[cfe-dev] how to write a source location?

Eli Friedman eli.friedman at gmail.com
Thu Aug 13 01:29:05 PDT 2009


2009/8/13 wangjue1985 <wangjue1985 at 126.com>:
> we want to write a front-end and my teacher let me to write a sourcelocation
> to locate some words where it to be,in which file and in which line?
> I think i can get some knowledge from clang ,but i find it`s too hard to
> understand.so who can help me to tell me about sourcelocation and
> source/file manager in clang and give some advice about my programe .
>                                                                        thank
> you all the same!

http://clang.llvm.org/docs/InternalsManual.html#SourceLocation is all
the documentation we really have about the clang SourceLocation and
SourceManager; if you're really interested in using it, I think you'll
have to read the code to get an understanding of what it's doing.

What language does your front-end process?  Unless your language uses
something like the preprocessor in C, it's probably overkill to borrow
anything from clang; a SourceLocation-like class that doesn't have to
deal with macro instantiations is extremely simple to write from
scratch.

-Eli




More information about the cfe-dev mailing list