2010-07-27 Paolo Carlini <paolo.carlini@oracle.com>
[official-gcc/alias-decl.git] / gcc / input.c
blobe5e051f9eaecaee404ff226423d2a4d44d40509a
1 /* Data and functions related to line maps and input files.
2 Copyright (C) 2004, 2007, 2008, 2009, 2010
3 Free Software Foundation, Inc.
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 3, or (at your option) any later
10 version.
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
21 #include "config.h"
22 #include "system.h"
23 #include "coretypes.h"
24 #include "intl.h"
25 #include "input.h"
27 /* Current position in real source file. */
29 location_t input_location;
31 struct line_maps *line_table;
33 expanded_location
34 expand_location (source_location loc)
36 expanded_location xloc;
37 if (loc <= BUILTINS_LOCATION)
39 xloc.file = loc == UNKNOWN_LOCATION ? NULL : _("<built-in>");
40 xloc.line = 0;
41 xloc.column = 0;
42 xloc.sysp = 0;
44 else
46 const struct line_map *map = linemap_lookup (line_table, loc);
47 xloc.file = map->to_file;
48 xloc.line = SOURCE_LINE (map, loc);
49 xloc.column = SOURCE_COLUMN (map, loc);
50 xloc.sysp = map->sysp != 0;
52 return xloc;