From 2cb6c26d54c3c360d19996e20291223fc28ed6c6 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Thu, 7 Apr 2016 06:58:58 -0400 Subject: [PATCH 27/91] FIXME: make read_name return a range --- gcc/read-md.c | 23 ++++++++++++++++++++++- gcc/read-md.h | 4 ++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/gcc/read-md.c b/gcc/read-md.c index 2943c52..3ea1849 100644 --- a/gcc/read-md.c +++ b/gcc/read-md.c @@ -412,6 +412,22 @@ read_skip_spaces (void) } } +/* FIXME. */ + +file_location +rtx_reader::make_location (file_location caret, file_location start, + file_location finish) const +{ + source_range src_range; + src_range.m_start = start; + src_range.m_finish = finish; + file_location combined_loc = COMBINE_LOCATION_DATA (m_line_table, + caret, + src_range, + NULL); + return combined_loc; +} + /* Read an rtx code name into NAME. It is terminated by any of the punctuation chars of rtx printed syntax. */ @@ -424,7 +440,7 @@ read_name_1 (struct md_name *name, file_location *out_loc) c = read_skip_spaces (); - *out_loc = rtx_reader_ptr->get_current_location (); + file_location start = rtx_reader_ptr->get_current_location (); i = 0; angle_bracket_depth = 0; @@ -456,6 +472,11 @@ read_name_1 (struct md_name *name, file_location *out_loc) c = read_char (); } + unread_char (c); + file_location end = rtx_reader_ptr->get_current_location (); + read_char (); + *out_loc = rtx_reader_ptr->make_location (start, start, end); + if (i == 0) return false; diff --git a/gcc/read-md.h b/gcc/read-md.h index 3a5d2b9..026719f 100644 --- a/gcc/read-md.h +++ b/gcc/read-md.h @@ -99,6 +99,10 @@ class rtx_reader void update_location (bool advancing); + file_location + make_location (file_location caret, file_location start, + file_location finish) const; + private: void handle_file (); void handle_toplevel_file (); -- 1.8.5.3