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: What to do with MAPPED_LOCATION


Robert Dewar wrote:
Can someone point me to a clear high level spec for the proposed
interface for MAPPED_LOCATION support.

I don't know of any high-level spec, except libcpp/include/line-map.h.


A "line_map" (singular) specifies how a sub-range of source_location
integer cookies are to be interpreted.  The "line_maps" table (there
is normally only one) is a collection of line_map mappings, in order
of the lowest source_location value mapped by each line_map, so finding
the correct line_map is a matter of binary search.  (And of course
normally there is quite a bit of locality, especially when initially
parsing.)

Each line_map has a filename ('to_file') and starting line ('to_line'),
and then it's a simple calculation to map a source_location to a line
and column number.

Each line_map also has an "included_from" field which is normally the
index of the line_map of that included this line_map: i.e. the outer
line_map in the include stack.  It seems plausible to generalize the
"included_from" field to also be used for "expanded from" or
"instantiated from", but I haven't tried to think through that.
--
	--Per Bothner
per@bothner.com   http://per.bothner.com/


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