This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]