From 67bc1ac22c29e751b8e0306889e85c1fd11293ca Mon Sep 17 00:00:00 2001
From: David Malcolm <dmalcolm@redhat.com>
Date: Tue, 6 Aug 2019 11:18:23 +0100
Subject: [PATCH 068/124] FIXME: revamp of colorization of diagnostic_paths
 (needs splitting up between diagnostics vs analyzer; needs dg test coverage

---
 gcc/analyzer/impl-2.cc             |  6 ++--
 gcc/analyzer/impl-3.cc             |  7 ++--
 gcc/analyzer/impl-4.cc             | 11 +++---
 gcc/analyzer/pending-diagnostic.cc |  7 ++--
 gcc/analyzer/pending-diagnostic.h  | 47 ++++++++++++++++----------
 gcc/analyzer/sm-file.cc            | 25 +++++++-------
 gcc/analyzer/sm-malloc.cc          | 68 ++++++++++++++++++++------------------
 gcc/diagnostic-color.c             |  1 +
 gcc/diagnostic-show-locus.c        | 19 +++++++++--
 gcc/diagnostic.def                 |  5 +++
 gcc/tree-diagnostic.c              | 19 +++++++----
 11 files changed, 131 insertions(+), 84 deletions(-)

diff --git a/gcc/analyzer/impl-2.cc b/gcc/analyzer/impl-2.cc
index c6656ee..f405694 100644
--- a/gcc/analyzer/impl-2.cc
+++ b/gcc/analyzer/impl-2.cc
@@ -676,7 +676,7 @@ public:
   {
   }
 
-  label_text get_desc (bool) const FINAL OVERRIDE
+  label_text get_desc (bool colorize) const FINAL OVERRIDE
   {
     if (m_origin)
       return label_text::take
@@ -700,7 +700,7 @@ public:
 	  {
 	    label_text custom_desc
 	      = m_pending_diagnostic->describe_state_change
-		  (evdesc::state_change (m_var, m_from, m_to, m_emission_id));
+	      (evdesc::state_change (colorize, m_var, m_from, m_to, m_emission_id));
 	    if (custom_desc.m_buffer)
 	      {
 		if (flag_analyzer_verbose_state_changes)
@@ -3442,7 +3442,7 @@ engine::maybe_emit (const candidate_diagnostic &cd)
 
   char *msg = NULL;
   label_text ev_desc
-    = cd.m_pd->describe_final_event (evdesc::final_event (cd.m_var,
+    = cd.m_pd->describe_final_event (evdesc::final_event (false, cd.m_var,
 							  cd.m_state));
   if (ev_desc.m_buffer)
     {
diff --git a/gcc/analyzer/impl-3.cc b/gcc/analyzer/impl-3.cc
index fbd7ad5..8ec9ea0 100644
--- a/gcc/analyzer/impl-3.cc
+++ b/gcc/analyzer/impl-3.cc
@@ -323,7 +323,7 @@ public:
   {
   }
 
-  label_text get_desc (bool) const FINAL OVERRIDE
+  label_text get_desc (bool colorize) const FINAL OVERRIDE
   {
     if (m_origin)
       return label_text::take
@@ -347,7 +347,8 @@ public:
 	  {
 	    label_text custom_desc
 	      = m_pending_diagnostic->describe_state_change
-		  (evdesc::state_change (m_var, m_from, m_to, m_emission_id));
+		 (evdesc::state_change (colorize, m_var, m_from, m_to,
+					m_emission_id));
 	    if (custom_desc.m_buffer)
 	      {
 		if (flag_analyzer_verbose_state_changes)
@@ -665,7 +666,7 @@ public:
   {
     char *msg = NULL;
     label_text ev_desc
-      = pd->describe_final_event (evdesc::final_event (var, state));
+      = pd->describe_final_event (evdesc::final_event (false, var, state));
     if (ev_desc.m_buffer)
       {
 	if (flag_analyzer_verbose_state_changes)
diff --git a/gcc/analyzer/impl-4.cc b/gcc/analyzer/impl-4.cc
index ffcf041..ee8d9a0 100644
--- a/gcc/analyzer/impl-4.cc
+++ b/gcc/analyzer/impl-4.cc
@@ -1766,7 +1766,8 @@ public:
 	  {
 	    label_text custom_desc
 	      = m_pending_diagnostic->describe_state_change
-		  (evdesc::state_change (m_var, m_from, m_to, m_emission_id));
+	      (evdesc::state_change (can_colorize, m_var, m_from, m_to,
+				     m_emission_id));
 	    if (custom_desc.m_buffer)
 	      {
 		if (flag_analyzer_verbose_state_changes)
@@ -2013,7 +2014,8 @@ public:
 	gcc_assert (m_var);
 	label_text custom_desc
 	  = m_pending_diagnostic->describe_call_with_state
-	  (evdesc::call_with_state (m_sedge->m_src->m_fun->decl,
+	  (evdesc::call_with_state (can_colorize,
+				    m_sedge->m_src->m_fun->decl,
 				    m_sedge->m_dest->m_fun->decl,
 				    m_var,
 				    m_critical_state));
@@ -2060,7 +2062,8 @@ public:
       {
 	label_text custom_desc
 	  = m_pending_diagnostic->describe_return_of_state
-	  (evdesc::return_of_state (m_sedge->m_dest->m_fun->decl,
+	  (evdesc::return_of_state (can_colorize,
+				    m_sedge->m_dest->m_fun->decl,
 				    m_sedge->m_src->m_fun->decl,
 				    m_critical_state));
 	if (custom_desc.m_buffer)
@@ -2098,7 +2101,7 @@ public:
     if (m_pending_diagnostic)
       {
 	label_text ev_desc = m_pending_diagnostic->describe_final_event
-	  (evdesc::final_event (m_var, m_state));
+	  (evdesc::final_event (can_colorize, m_var, m_state));
 	if (ev_desc.m_buffer)
 	  {
 	    if (m_sm && flag_analyzer_verbose_state_changes)
diff --git a/gcc/analyzer/pending-diagnostic.cc b/gcc/analyzer/pending-diagnostic.cc
index a07339b..ef5cbeb 100644
--- a/gcc/analyzer/pending-diagnostic.cc
+++ b/gcc/analyzer/pending-diagnostic.cc
@@ -53,12 +53,13 @@ along with GCC; see the file COPYING3.  If not see
 #include "analyzer/pending-diagnostic.h"
 
 label_text
-pending_diagnostic::formatted_print (const char *fmt, ...)
+evdesc::event_desc::formatted_print (const char *fmt, ...) const
 {
   pretty_printer *pp = global_dc->printer->clone ();
 
-  /* FIXME.  */
-  pp_show_color (pp) = false;
+  /* FIXME: getting colorization from here, so that e.g. we can disable it for
+     JSON output.  */
+  pp_show_color (pp) = m_colorize;
 
   text_info ti;
   rich_location rich_loc (line_table, UNKNOWN_LOCATION);
diff --git a/gcc/analyzer/pending-diagnostic.h b/gcc/analyzer/pending-diagnostic.h
index ce7b235..63bd223 100644
--- a/gcc/analyzer/pending-diagnostic.h
+++ b/gcc/analyzer/pending-diagnostic.h
@@ -68,15 +68,27 @@ class event_id_t
 
 namespace evdesc {
 
+struct event_desc
+{
+  event_desc (bool colorize) : m_colorize (colorize) {}
+
+  label_text formatted_print (const char *fmt, ...) const
+    ATTRIBUTE_GCC_DIAG(2,3);
+
+  bool m_colorize;
+};
+
 /* For use by pending_diagnostic::describe_state_change.  */
 
-struct state_change
+ struct state_change : public event_desc
 {
-  state_change (tree expr,
+  state_change (bool colorize,
+		tree expr,
 		state_machine::state_t old_state,
 		state_machine::state_t new_state,
 		event_id_t event_id)
-  : m_expr (expr), m_old_state (old_state),
+  : event_desc (colorize),
+    m_expr (expr), m_old_state (old_state),
     m_new_state (new_state), m_event_id (event_id)
   {}
 
@@ -88,11 +100,13 @@ struct state_change
 
 /* For use by pending_diagnostic::describe_call_with_state.  */
 
-struct call_with_state
+struct call_with_state : public event_desc
 {
-  call_with_state (tree caller_fndecl, tree callee_fndecl,
+  call_with_state (bool colorize,
+		   tree caller_fndecl, tree callee_fndecl,
 		   tree expr, state_machine::state_t state)
-  : m_caller_fndecl (caller_fndecl),
+  : event_desc (colorize),
+    m_caller_fndecl (caller_fndecl),
     m_callee_fndecl (callee_fndecl),
     m_expr (expr),
     m_state (state)
@@ -107,11 +121,13 @@ struct call_with_state
 
 /* For use by pending_diagnostic::describe_return_of_state.  */
 
-struct return_of_state
+struct return_of_state : public event_desc
 {
-  return_of_state (tree caller_fndecl, tree callee_fndecl,
+  return_of_state (bool colorize,
+		   tree caller_fndecl, tree callee_fndecl,
 		   state_machine::state_t state)
-  : m_caller_fndecl (caller_fndecl),
+  : event_desc (colorize),
+    m_caller_fndecl (caller_fndecl),
     m_callee_fndecl (callee_fndecl),
     m_state (state)
   {
@@ -124,10 +140,12 @@ struct return_of_state
 
 /* For use by pending_diagnostic::describe_final_event.  */
 
-struct final_event
+struct final_event : public event_desc
 {
-  final_event (tree expr, state_machine::state_t state)
-  : m_expr (expr), m_state (state)
+  final_event (bool colorize,
+	       tree expr, state_machine::state_t state)
+  : event_desc (colorize),
+    m_expr (expr), m_state (state)
   {}
 
   tree m_expr;
@@ -254,11 +272,6 @@ class pending_diagnostic
   }
 
   /* End of precision-of-wording vfuncs.  */
-
-  /* Utility function for implementing the above vfuncs.  */
-
-  static label_text formatted_print (const char *fmt, ...)
-    ATTRIBUTE_GCC_DIAG(1,2);
 };
 
 /* A template to make it easier to make subclasses of pending_diagnostic.
diff --git a/gcc/analyzer/sm-file.cc b/gcc/analyzer/sm-file.cc
index ee3f9b0..faa67fa 100644
--- a/gcc/analyzer/sm-file.cc
+++ b/gcc/analyzer/sm-file.cc
@@ -117,11 +117,11 @@ public:
       return label_text::borrow ("opened here");
     if (change.m_old_state == m_sm.m_unchecked
 	&& change.m_new_state == m_sm.m_nonnull)
-      return formatted_print ("assuming %qE is non-NULL",
-			      change.m_expr);
+      return change.formatted_print ("assuming %qE is non-NULL",
+				     change.m_expr);
     if (change.m_new_state == m_sm.m_null)
-      return formatted_print ("assuming %qE is NULL",
-			      change.m_expr);
+      return change.formatted_print ("assuming %qE is NULL",
+				     change.m_expr);
     return label_text ();
   }
 
@@ -152,17 +152,18 @@ public:
     if (change.m_new_state == m_sm.m_closed)
       {
 	m_first_fclose_event = change.m_event_id;
-	return formatted_print ("first %qs here", "fclose");
+	return change.formatted_print ("first %qs here", "fclose");
       }
     return file_diagnostic::describe_state_change (change);
   }
 
-  label_text describe_final_event (const evdesc::final_event &) FINAL OVERRIDE
+  label_text describe_final_event (const evdesc::final_event &ev) FINAL OVERRIDE
   {
     if (m_first_fclose_event.known_p ())
-      return formatted_print ("second %qs here; first %qs was at (%i)",
-			      "fclose", "fclose", m_first_fclose_event.one_based ());
-    return formatted_print ("second %qs here", "fclose");
+      return ev.formatted_print ("second %qs here; first %qs was at (%i)",
+				 "fclose", "fclose",
+				 m_first_fclose_event.one_based ());
+    return ev.formatted_print ("second %qs here", "fclose");
   }
 
 private:
@@ -203,10 +204,10 @@ public:
   label_text describe_final_event (const evdesc::final_event &ev) FINAL OVERRIDE
   {
     if (m_fopen_event.known_p ())
-      return formatted_print ("%qE leaks here; was opened at (%i)",
-			      ev.m_expr, m_fopen_event.one_based ());
+      return ev.formatted_print ("%qE leaks here; was opened at (%i)",
+				 ev.m_expr, m_fopen_event.one_based ());
     else
-      return formatted_print ("%qE leaks here", ev.m_expr);
+      return ev.formatted_print ("%qE leaks here", ev.m_expr);
   }
 
 private:
diff --git a/gcc/analyzer/sm-malloc.cc b/gcc/analyzer/sm-malloc.cc
index f901891..12a5cd0 100644
--- a/gcc/analyzer/sm-malloc.cc
+++ b/gcc/analyzer/sm-malloc.cc
@@ -120,11 +120,11 @@ public:
       return label_text::borrow ("allocated here");
     if (change.m_old_state == m_sm.m_unchecked
 	&& change.m_new_state == m_sm.m_nonnull)
-      return formatted_print ("assuming %qE is non-NULL",
-			      change.m_expr);
+      return change.formatted_print ("assuming %qE is non-NULL",
+				     change.m_expr);
     if (change.m_new_state == m_sm.m_null)
-      return formatted_print ("assuming %qE is NULL",
-			      change.m_expr);
+      return change.formatted_print ("assuming %qE is NULL",
+				     change.m_expr);
     return label_text ();
   }
 
@@ -172,7 +172,7 @@ public:
     if (change.m_new_state == m_sm.m_free)
       {
 	m_first_free_event = change.m_event_id;
-	return formatted_print ("first %qs here", "free");
+	return change.formatted_print ("first %qs here", "free");
       }
     return malloc_diagnostic::describe_state_change (change);
   }
@@ -181,18 +181,19 @@ public:
     FINAL OVERRIDE
   {
     if (info.m_state == m_sm.m_free)
-      return formatted_print
+      return info.formatted_print
 	("passing freed pointer %qE in call to %qE from %qE",
 	 info.m_expr, info.m_callee_fndecl, info.m_caller_fndecl);
     return label_text ();
   }
 
-  label_text describe_final_event (const evdesc::final_event &) FINAL OVERRIDE
+  label_text describe_final_event (const evdesc::final_event &ev) FINAL OVERRIDE
   {
     if (m_first_free_event.known_p ())
-      return formatted_print ("second %qs here; first %qs was at (%i)",
-			      "free", "free", m_first_free_event.one_based ());
-    return formatted_print ("second %qs here", "free");
+      return ev.formatted_print ("second %qs here; first %qs was at (%i)",
+				 "free", "free",
+				 m_first_free_event.one_based ());
+    return ev.formatted_print ("second %qs here", "free");
   }
 
   /* FIXME: maybe also something like this.  */
@@ -234,8 +235,8 @@ public:
     FINAL OVERRIDE
   {
     if (info.m_state == m_sm.m_unchecked)
-      return formatted_print ("possible return of NULL to %qE from %qE",
-			      info.m_caller_fndecl, info.m_callee_fndecl);
+      return info.formatted_print ("possible return of NULL to %qE from %qE",
+				   info.m_caller_fndecl, info.m_callee_fndecl);
     return label_text ();
   }
 
@@ -268,10 +269,11 @@ public:
   label_text describe_final_event (const evdesc::final_event &ev) FINAL OVERRIDE
   {
     if (m_origin_of_unchecked_event.known_p ())
-      return formatted_print ("%qE could be NULL: unchecked value from (%i)",
-			      ev.m_expr, m_origin_of_unchecked_event.one_based ());
+      return ev.formatted_print ("%qE could be NULL: unchecked value from (%i)",
+				 ev.m_expr,
+				 m_origin_of_unchecked_event.one_based ());
     else
-      return formatted_print ("%qE could be NULL", ev.m_expr);
+      return ev.formatted_print ("%qE could be NULL", ev.m_expr);
   }
 
 };
@@ -332,14 +334,14 @@ public:
   label_text describe_final_event (const evdesc::final_event &ev) FINAL OVERRIDE
   {
     if (m_origin_of_unchecked_event.known_p ())
-      return formatted_print ("argument %u (%qE) from (%i) could be NULL"
-			      " where non-null expected",
-			      m_arg_idx + 1, ev.m_expr,
-			      m_origin_of_unchecked_event.one_based ());
+      return ev.formatted_print ("argument %u (%qE) from (%i) could be NULL"
+				 " where non-null expected",
+				 m_arg_idx + 1, ev.m_expr,
+				 m_origin_of_unchecked_event.one_based ());
     else
-      return formatted_print ("argument %u (%qE) could be NULL"
-			      " where non-null expected",
-			      m_arg_idx + 1, ev.m_expr);
+      return ev.formatted_print ("argument %u (%qE) could be NULL"
+				 " where non-null expected",
+				 m_arg_idx + 1, ev.m_expr);
   }
 
   // TODO
@@ -406,9 +408,9 @@ public:
   /* FIXME.  */
   label_text describe_final_event (const evdesc::final_event &ev) FINAL OVERRIDE
   {
-    return formatted_print ("argument %u (%qE) NULL"
-			    " where non-null expected",
-			    m_arg_idx + 1, ev.m_expr);
+    return ev.formatted_print ("argument %u (%qE) NULL"
+			       " where non-null expected",
+			       m_arg_idx + 1, ev.m_expr);
   }
 
 private:
@@ -449,10 +451,10 @@ public:
   label_text describe_final_event (const evdesc::final_event &ev) FINAL OVERRIDE
   {
     if (m_free_event.known_p ())
-      return formatted_print ("use after %<free%> of %qE; freed at (%i)",
-			      ev.m_expr, m_free_event.one_based ());
+      return ev.formatted_print ("use after %<free%> of %qE; freed at (%i)",
+				 ev.m_expr, m_free_event.one_based ());
     else
-      return formatted_print ("use after %<free%> of %qE", ev.m_expr);
+      return ev.formatted_print ("use after %<free%> of %qE", ev.m_expr);
   }
 
 private:
@@ -489,10 +491,10 @@ public:
   label_text describe_final_event (const evdesc::final_event &ev) FINAL OVERRIDE
   {
     if (m_malloc_event.known_p ())
-      return formatted_print ("%qE leaks here; was allocated at (%i)",
-			      ev.m_expr, m_malloc_event.one_based ());
+      return ev.formatted_print ("%qE leaks here; was allocated at (%i)",
+				 ev.m_expr, m_malloc_event.one_based ());
     else
-      return formatted_print ("%qE leaks here", ev.m_expr);
+      return ev.formatted_print ("%qE leaks here", ev.m_expr);
   }
 
 private:
@@ -562,9 +564,9 @@ public:
   }
 
   /* FIXME.  */
-  label_text describe_final_event (const evdesc::final_event &) FINAL OVERRIDE
+  label_text describe_final_event (const evdesc::final_event &ev) FINAL OVERRIDE
   {
-    return formatted_print ("call to %qs here", "free");
+    return ev.formatted_print ("call to %qs here", "free");
   }
 
 private:
diff --git a/gcc/diagnostic-color.c b/gcc/diagnostic-color.c
index 9387d77..099c3c3 100644
--- a/gcc/diagnostic-color.c
+++ b/gcc/diagnostic-color.c
@@ -89,6 +89,7 @@ static struct color_cap color_dict[] =
   { "range2", SGR_SEQ (COLOR_FG_BLUE), 6, false },
   { "locus", SGR_SEQ (COLOR_BOLD), 5, false },
   { "quote", SGR_SEQ (COLOR_BOLD), 5, false },
+  { "path", SGR_SEQ (COLOR_BOLD COLOR_SEPARATOR COLOR_FG_CYAN), 4, false },
   { "fixit-insert", SGR_SEQ (COLOR_FG_GREEN), 12, false },
   { "fixit-delete", SGR_SEQ (COLOR_FG_RED), 12, false },
   { "diff-filename", SGR_SEQ (COLOR_BOLD), 13, false },
diff --git a/gcc/diagnostic-show-locus.c b/gcc/diagnostic-show-locus.c
index c2c94e5..38c0756 100644
--- a/gcc/diagnostic-show-locus.c
+++ b/gcc/diagnostic-show-locus.c
@@ -86,7 +86,17 @@ class colorizer
 	     diagnostic_t diagnostic_kind);
   ~colorizer ();
 
-  void set_range (int range_idx) { set_state (range_idx); }
+  void set_range (int range_idx)
+  {
+    /* Normally we emphasize the primary location, then alternate between
+       two colors for the secondary locations.
+       But if we're printing a run of events in a diagnostic path, that
+       makes no sense, so print all of them with the same colorization.  */
+    if (m_diagnostic_kind == DK_DIAGNOSTIC_PATH)
+      set_state (0);
+    else
+      set_state (range_idx);
+  }
   void set_normal_text () { set_state (STATE_NORMAL_TEXT); }
   void set_fixit_insert () { set_state (STATE_FIXIT_INSERT); }
   void set_fixit_delete () { set_state (STATE_FIXIT_DELETE); }
@@ -304,6 +314,7 @@ class layout
   bool m_show_labels_p;
   bool m_show_line_numbers_p;
   bool m_use_nn_for_line_numbers_p;
+  bool m_diagnostic_path_p;
   auto_vec <layout_range> m_layout_ranges;
   auto_vec <const fixit_hint *> m_fixit_hints;
   auto_vec <line_span> m_line_spans;
@@ -851,6 +862,7 @@ layout::layout (diagnostic_context * context,
   m_show_labels_p (context->show_labels_p),
   m_show_line_numbers_p (context->show_line_numbers_p),
   m_use_nn_for_line_numbers_p (context->use_nn_for_line_numbers_p),
+  m_diagnostic_path_p (diagnostic_kind == DK_DIAGNOSTIC_PATH),
   m_layout_ranges (richloc->get_num_locations ()),
   m_fixit_hints (richloc->get_num_fixit_hints ()),
   m_line_spans (1 + richloc->get_num_locations ()),
@@ -1569,7 +1581,10 @@ layout::print_any_labels (linenum_type row)
 	      {
 		//gcc_assert (column <= label->m_column);
 		move_to_column (&column, label->m_column, true);
-		m_colorizer.set_range (label->m_state_idx);
+		/* Colorize the text, unless it's for events in a
+		   diagnostic_path.  */
+		if (!m_diagnostic_path_p)
+		  m_colorizer.set_range (label->m_state_idx);
 		pp_string (m_pp, label->m_text.m_buffer);
 		m_colorizer.set_normal_text ();
 		column += label->m_length;
diff --git a/gcc/diagnostic.def b/gcc/diagnostic.def
index f3c0b2c..b271ea4 100644
--- a/gcc/diagnostic.def
+++ b/gcc/diagnostic.def
@@ -38,6 +38,11 @@ DEFINE_DIAGNOSTIC_KIND (DK_WARNING, "warning: ", "warning")
 DEFINE_DIAGNOSTIC_KIND (DK_ANACHRONISM, "anachronism: ", "warning")
 DEFINE_DIAGNOSTIC_KIND (DK_NOTE, "note: ", "note")
 DEFINE_DIAGNOSTIC_KIND (DK_DEBUG, "debug: ", "note")
+
+/* For use when using the diagnostic_show_locus machinery to show
+   a range of events within a path.  */
+DEFINE_DIAGNOSTIC_KIND (DK_DIAGNOSTIC_PATH, "path: ", "path")
+
 /* These two would be re-classified as DK_WARNING or DK_ERROR, so the
 prefix does not matter.  */
 DEFINE_DIAGNOSTIC_KIND (DK_PEDWARN, "pedwarn: ", NULL)
diff --git a/gcc/tree-diagnostic.c b/gcc/tree-diagnostic.c
index 27214a0..00aa684 100644
--- a/gcc/tree-diagnostic.c
+++ b/gcc/tree-diagnostic.c
@@ -326,14 +326,19 @@ class path_label : public range_label
     unsigned event_idx = m_start_idx + range_idx;
     const diagnostic_event &event = m_path->get_event (event_idx);
 
-    /* Get the description of the event without colorization: we
-       shouldn't colorize within a range_label.  */
-    label_text event_text (event.get_desc (false));
+    /* Get the description of the event, perhaps with colorization:
+       normally, we don't colorize within a range_label, but this
+       is special-cased for diagnostic paths.  */
+    bool colorize = pp_show_color (global_dc->printer);
+    label_text event_text (event.get_desc (colorize));
     gcc_assert (event_text.m_buffer);
-    label_text result
-      = label_text::take (xasprintf ("(%i) %s", event_idx + 1,
-				     event_text.m_buffer));
+    pretty_printer pp;
+    pp_show_color (&pp) = pp_show_color (global_dc->printer);
+    pp_printf (&pp, "%r(%i)%R %s",
+	       "path", // FIXME: or maybe support emphasizing them
+	       event_idx + 1, event_text.m_buffer);
     event_text.maybe_free ();
+    label_text result = label_text::take (xstrdup (pp_formatted_text (&pp)));
     return result;
   }
 
@@ -771,7 +776,7 @@ print_event_range (pretty_printer *pp,
 	  dc.min_margin_width = global_dc->min_margin_width;
 	  dc.caret_chars[0] = '^';
 	  diagnostic_set_caret_max_width (&dc, pp_line_cutoff (pp));
-	  diagnostic_show_locus (&dc, &richloc, DK_NOTE); // FIXME
+	  diagnostic_show_locus (&dc, &richloc, DK_DIAGNOSTIC_PATH);
 	}
 
       start_idx = j;
-- 
1.8.5.3

