gcc/libcpp
Manuel López-Ibáñez 87b470b363 Handle lines encoded into several maps in linemap_position_for_loc_and_offset
linemap_position_for_loc_and_offset() tries to generate a location_t
encoding a column offset from the current location, for example, point
to a certain character inside a string. This is trivial to do when the
new location "fits within" the map of the original location. However,
it may happen that the (long) line corresponding to the original
location is encoded in several maps, thus the new location should
actually be encoded in a subsequent map from the original location.
This patch detects this case and adjusts the map correspondingly.

(This shows that the line-map representation is quite wasteful in this
case, because line-maps always start at column 0. That is, map[0]
highest location may encode up to line 8 column 80, then
map[1]->start_location starts encoding at line 8 column 0. Thus, there
are two location_t values that point to the same source location.)

libcpp/ChangeLog:

2015-09-21  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	PR c/66415
	* line-map.c (linemap_position_for_loc_and_offset): Handle the
	case of long lines encoded in multiple maps.

gcc/testsuite/ChangeLog:

2015-09-21  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	PR c/66415
	* gcc.dg/cpp/pr66415-1.c: Test column number.

From-SVN: r227975
2015-09-21 14:52:09 +00:00
..
include Address -Wsign-compare diagnostics 2015-07-08 16:48:11 +02:00
po * sv.po: Update. 2015-07-31 01:48:04 +01:00
ChangeLog Handle lines encoded into several maps in linemap_position_for_loc_and_offset 2015-09-21 14:52:09 +00:00
ChangeLog.jit Merger of dmalcolm/jit branch from git 2014-11-11 21:55:52 +00:00
Makefile.in Update copyright years. 2015-01-05 13:33:28 +01:00
aclocal.m4 libcpp: Bump to automake 1.11.6 2015-05-13 11:02:17 +00:00
charset.c re PR preprocessor/53690 ([C++11] \u0000 and \U00000000 are wrongly encoded as U+0001.) 2015-07-02 18:54:41 +00:00
config.in configure.ac: Remove long long and __int64 type checks... 2014-05-26 08:19:02 +00:00
configure Makefile.def (libiconv): Define bootstrap=true. 2015-08-07 01:13:52 -04:00
configure.ac configure.ac: Remove long long and __int64 type checks... 2014-05-26 08:19:02 +00:00
directives-only.c Update copyright years. 2015-01-05 13:33:28 +01:00
directives.c Replace line_map union with C++ class hierarchy 2015-05-19 13:18:01 +00:00
errors.c Update copyright years. 2015-01-05 13:33:28 +01:00
expr.c Implement N4197 - Adding u8 character literals 2015-06-30 12:58:48 +00:00
files.c Replace line_map union with C++ class hierarchy 2015-05-19 13:18:01 +00:00
identifiers.c Update copyright years. 2015-01-05 13:33:28 +01:00
init.c Implement N4197 - Adding u8 character literals 2015-06-30 12:58:48 +00:00
internal.h re PR preprocessor/53690 ([C++11] \u0000 and \U00000000 are wrongly encoded as U+0001.) 2015-07-02 18:54:41 +00:00
lex.c re PR preprocessor/53690 ([C++11] \u0000 and \U00000000 are wrongly encoded as U+0001.) 2015-07-02 18:54:41 +00:00
line-map.c Handle lines encoded into several maps in linemap_position_for_loc_and_offset 2015-09-21 14:52:09 +00:00
location-example.txt libcpp/input.c: Add a way to visualize the linemaps (-fdump-internal-locations) 2015-05-13 13:58:18 +00:00
macro.c Implement N4197 - Adding u8 character literals 2015-06-30 12:58:48 +00:00
makeucnid.c Update copyright years. 2015-01-05 13:33:28 +01:00
mkdeps.c Update copyright years. 2015-01-05 13:33:28 +01:00
pch.c Fix indentation issues seen by -Wmisleading-indentation 2015-05-05 19:41:11 +00:00
symtab.c Update copyright years. 2015-01-05 13:33:28 +01:00
system.h system.h (INTTYPE_MINIMUM): Rewrite to avoid shift warning. 2015-09-07 09:11:17 +00:00
traditional.c re PR preprocessor/65238 (__has_attribute is not handled properly with -traditional-cpp.) 2015-03-23 09:02:39 +01:00
ucnid.h Update copyright years. 2015-01-05 13:33:28 +01:00
ucnid.tab Update copyright years. 2015-01-05 13:33:28 +01:00