aboutsummaryrefslogtreecommitdiff
path: root/gcc/input.c
diff options
context:
space:
mode:
authorDodji Seketeli <dodji@redhat.com>2011-10-25 08:58:54 +0000
committerDodji Seketeli <dodji@gcc.gnu.org>2011-10-25 10:58:54 +0200
commit84756fd40adc5ceb732dccc84056e08d3ef0186d (patch)
tree9772bc60a136c3ea7e6977711cf51d5fb4469798 /gcc/input.c
parentae5f5715d62c096065139a40cc91e4acfc070c8c (diff)
downloadgcc-84756fd40adc5ceb732dccc84056e08d3ef0186d.zip
gcc-84756fd40adc5ceb732dccc84056e08d3ef0186d.tar.gz
gcc-84756fd40adc5ceb732dccc84056e08d3ef0186d.tar.bz2
Support expansion of reserved locations wrapped in virtual locations
libcpp/ * include/line-map.h (linemap_expand_location): Take a line table parameter. Update comment. (linemap_resolve_location): Update comment. (linemap_expand_location_full): Remove. * line-map.c (linemap_resolve_location): Handle reserved locations; return a NULL map in those cases. (linemap_expand_location): If location is reserved, return a zeroed expanded location. Update comment. Take a line table to assert that the function takes non-virtual locations only. (linemap_expand_location_full): remove. (linemap_dump_location): Handle the fact that linemap_resolve_location can return NULL line maps when the location resolves to a reserved location. gcc/ * input.c (expand_location): Rewrite using linemap_resolve_location and linemap_expand_location. Add a comment. From-SVN: r180426
Diffstat (limited to 'gcc/input.c')
-rw-r--r--gcc/input.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/gcc/input.c b/gcc/input.c
index a780f5c..4077f9e 100644
--- a/gcc/input.c
+++ b/gcc/input.c
@@ -30,20 +30,23 @@ location_t input_location;
struct line_maps *line_table;
+/* Expand the source location LOC into a human readable location. If
+ LOC resolves to a builtin location, the file name of the readable
+ location is set to the string "<built-in>". */
+
expanded_location
expand_location (source_location loc)
{
expanded_location xloc;
+ const struct line_map *map;
+
+ loc = linemap_resolve_location (line_table, loc,
+ LRK_SPELLING_LOCATION, &map);
+ xloc = linemap_expand_location (line_table, map, loc);
+
if (loc <= BUILTINS_LOCATION)
- {
- xloc.file = loc == UNKNOWN_LOCATION ? NULL : _("<built-in>");
- xloc.line = 0;
- xloc.column = 0;
- xloc.sysp = 0;
- }
- else
- xloc = linemap_expand_location_full (line_table, loc,
- LRK_SPELLING_LOCATION);
+ xloc.file = loc == UNKNOWN_LOCATION ? NULL : _("<built-in>");
+
return xloc;
}