aboutsummaryrefslogtreecommitdiff
path: root/gcc/input.c
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2015-09-15 16:53:01 +0000
committerDavid Malcolm <dmalcolm@gcc.gnu.org>2015-09-15 16:53:01 +0000
commit31bdd08a9d21a2fd7019bbd7b178c8911a7d2e41 (patch)
treeb8835d6ddb4631db4e8d4f261d3286ea4d207b80 /gcc/input.c
parentc55721c0dfee6d4de107cab63bfe0d1ebf5bdfde (diff)
downloadgcc-31bdd08a9d21a2fd7019bbd7b178c8911a7d2e41.zip
gcc-31bdd08a9d21a2fd7019bbd7b178c8911a7d2e41.tar.gz
gcc-31bdd08a9d21a2fd7019bbd7b178c8911a7d2e41.tar.bz2
Change of location_get_source_line signature
gcc/ChangeLog: * input.h (location_get_source_line): Drop "expanded_location" param in favor of a file and line number. * input.c (location_get_source_line): Likewise. (dump_location_info): Update for change in signature of location_get_source_line. * diagnostic.c (diagnostic_print_caret_line): Likewise. gcc/c-family/ChangeLog: * c-format.c (location_from_offset): Update for change in signature of location_get_source_line. * c-indentation.c (get_visual_column): Likewise. (line_contains_hash_if): Likewise. From-SVN: r227800
Diffstat (limited to 'gcc/input.c')
-rw-r--r--gcc/input.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/gcc/input.c b/gcc/input.c
index 59cab5c..e7302a4 100644
--- a/gcc/input.c
+++ b/gcc/input.c
@@ -684,27 +684,27 @@ read_line_num (fcache *c, size_t line_num,
return read_next_line (c, line, line_len);
}
-/* Return the physical source line that corresponds to xloc in a
+/* Return the physical source line that corresponds to FILE_PATH/LINE in a
buffer that is statically allocated. The newline is replaced by
the null character. Note that the line can contain several null
characters, so LINE_LEN, if non-null, points to the actual length
of the line. */
const char *
-location_get_source_line (expanded_location xloc,
+location_get_source_line (const char *file_path, int line,
int *line_len)
{
static char *buffer;
static ssize_t len;
- if (xloc.line == 0)
+ if (line == 0)
return NULL;
- fcache *c = lookup_or_add_file_to_cache_tab (xloc.file);
+ fcache *c = lookup_or_add_file_to_cache_tab (file_path);
if (c == NULL)
return NULL;
- bool read = read_line_num (c, xloc.line, &buffer, &len);
+ bool read = read_line_num (c, line, &buffer, &len);
if (read && line_len)
*line_len = len;
@@ -971,7 +971,9 @@ dump_location_info (FILE *stream)
/* Beginning of a new source line: draw the line. */
int line_size;
- const char *line_text = location_get_source_line (exploc, &line_size);
+ const char *line_text = location_get_source_line (exploc.file,
+ exploc.line,
+ &line_size);
if (!line_text)
break;
fprintf (stream,