This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: getting source locations ....
- From: Andrew Pinski <pinskia at physics dot uc dot edu>
- To: basile at starynkevitch dot net (Basile STARYNKEVITCH)
- Cc: gcc at gcc dot gnu dot org
- Date: Sat, 30 Dec 2006 17:55:49 -0500 (EST)
- Subject: Re: getting source locations ....
>
> Hello All,
>
> I am interested in getting the source location (at least the start
> source file, linenumber, and possibly column number and end source
> file, linenumber, ...) of
>
> a GIMPLE/SSA tree (I want the corresponding source location, I very
> much realize that the source location might not exist)
>
> a basic block
>
> a cgraph node
>
>
> So far, for the GIMPLE/SSA tree, I'm doing something like
>
>
> ################################################################
> /***
> * return true if a (GIMPLE/SSA) tree TR has a position
> * and in that case fill the PFILENAME and PLINENO
> ***/
> bool comprobe_get_position(tree tr, char**pfilename, int* plineno)
> {
> if (EXPR_P (tr))
This really should be simplified to:
if (CAN_HAVE_LOCATION_P (tr) && EXPR_HAS_LOCATION (tr))
{
...
}
Plus I would use EXPR_FILENAME and not expr_filename.
Thanks,
Andrew Pinski