aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2018-09-17 23:32:12 +0000
committerDavid Malcolm <dmalcolm@gcc.gnu.org>2018-09-17 23:32:12 +0000
commit9c4a4b3cbd4970447d28963481c04bb7b7d2c4f2 (patch)
treec99eac9e12ee799efbd01d27abbba880659e4241 /gcc/c-family
parent71b731be7a9fa2b92ee63abeb48900008902f7a6 (diff)
downloadgcc-9c4a4b3cbd4970447d28963481c04bb7b7d2c4f2.zip
gcc-9c4a4b3cbd4970447d28963481c04bb7b7d2c4f2.tar.gz
gcc-9c4a4b3cbd4970447d28963481c04bb7b7d2c4f2.tar.bz2
Add range_idx param to range_label::get_text
This patch updates the pure virtual function range_label::get_text (and its implementations) so that the index of the range is passed in, allowing for one label instance to be shared by multiple ranges. gcc/c-family/ChangeLog: * c-format.c (range_label_for_format_type_mismatch::get_text): Update for new param. gcc/c/ChangeLog: * c-objc-common.c (range_label_for_type_mismatch::get_text): Update for new param. * c-typeck.c (maybe_range_label_for_tree_type_mismatch::get_text): Likewise. gcc/cp/ChangeLog: * error.c (range_label_for_type_mismatch::get_text): Update for new param. gcc/ChangeLog: * diagnostic-show-locus.c (class layout_range): Add field "m_original_idx". (layout_range::layout_range): Add "original_idx" param and use it to initialize new field. (make_range): Use 0 for original_idx. (layout::layout): Pass in index to calls to maybe_add_location_range. (layout::maybe_add_location_range): Add param "original_idx" and pass it on to layout_range. (layout::print_any_labels): Pass on range->m_original_idx to get_text call. (gcc_rich_location::add_location_if_nearby): Use 0 for original_idx. * gcc-rich-location.h (text_range_label::get_text): Update for new param. (range_label_for_type_mismatch::get_text): Likewise. libcpp/ChangeLog: * include/line-map.h (range_label::get_text): Add param "range_idx". From-SVN: r264376
Diffstat (limited to 'gcc/c-family')
-rw-r--r--gcc/c-family/ChangeLog5
-rw-r--r--gcc/c-family/c-format.c4
2 files changed, 7 insertions, 2 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index b70d77a..f2ec394 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,5 +1,10 @@
2018-09-17 David Malcolm <dmalcolm@redhat.com>
+ * c-format.c (range_label_for_format_type_mismatch::get_text):
+ Update for new param.
+
+2018-09-17 David Malcolm <dmalcolm@redhat.com>
+
* c-format.c (format_warning_at_char): Update for introduction of
format_string_diagnostic_t.
(format_type_warning): Likewise.
diff --git a/gcc/c-family/c-format.c b/gcc/c-family/c-format.c
index a7edfca..a1133c7 100644
--- a/gcc/c-family/c-format.c
+++ b/gcc/c-family/c-format.c
@@ -3597,9 +3597,9 @@ class range_label_for_format_type_mismatch
{
}
- label_text get_text () const FINAL OVERRIDE
+ label_text get_text (unsigned range_idx) const FINAL OVERRIDE
{
- label_text text = range_label_for_type_mismatch::get_text ();
+ label_text text = range_label_for_type_mismatch::get_text (range_idx);
if (text.m_buffer == NULL)
return text;