Re: Access to source code from an analyser

2012-02-01 Thread Diego Novillo
On 12-01-19 05:06 , Alberto Lozano Alelu wrote: I need to have source text For that, you will need to read the file or get the line from libcpp's buffers. Accessing libcpp's buffer will not be trivial, since they are in libcpp's private structures. You're better off opening the file and

Re: Access to source code from an analyser

2012-01-20 Thread Manuel López-Ibáñez
On Thu, 2012-01-19 at 14:06 +0100, Alberto Lozano Alelu wrote: Hello. Thanks for your fast response. With expand_location I get struct expanded_location which has these fields: type = struct { const char *file; int line; int column; unsigned char sysp; } But it hasn't

Re: Access to source code from an analyser

2012-01-20 Thread Tom Tromey
Manuel == Manuel López-Ibáñez lopeziba...@gmail.com writes: Manuel However, to be honest, even if you implement your own source-location Manuel manager in your own plugin code, I don't think it will be very precise Manuel because the internal representation of GCC C/C++ FE is not very close

Access to source code from an analyser

2012-01-19 Thread Alberto Lozano Alelu
Hello. I'm developing a C++ analyzer and I would like to get source text of file when I'm analyzing C++ code. When I'm analyzing source code I would like to get source text line from a location of a type. I have got type location but I don't know a function to get source line text from source

Re: Access to source code from an analyser

2012-01-19 Thread Richard Guenther
On Thu, Jan 19, 2012 at 12:56 PM, Alberto Lozano Alelu ale...@gmail.com wrote: Hello. I'm developing a C++ analyzer and I would like to get source text of file when I'm analyzing C++ code. When I'm analyzing source code I would like to get source text line from a location of a type. I have

Re: Access to source code from an analyser

2012-01-19 Thread Alberto Lozano Alelu
Hello. Thanks for your fast response. With expand_location I get struct expanded_location which has these fields: type = struct { const char *file; int line; int column; unsigned char sysp; } But it hasn't source line text. I know how I have to use expand_location function but

Re: Access to source code from an analyser

2012-01-19 Thread Richard Guenther
On Thu, Jan 19, 2012 at 2:06 PM, Alberto Lozano Alelu ale...@gmail.com wrote: Hello. Thanks for your fast response. With expand_location I get struct expanded_location which has these fields: type = struct {    const char *file;    int line;    int column;    unsigned char sysp; } But

Re: Access to source code from an analyser

2012-01-19 Thread David Malcolm
On Thu, 2012-01-19 at 14:06 +0100, Alberto Lozano Alelu wrote: Hello. Thanks for your fast response. With expand_location I get struct expanded_location which has these fields: type = struct { const char *file; int line; int column; unsigned char sysp; } But it