aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-diagnostic.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree-diagnostic.c')
-rw-r--r--gcc/tree-diagnostic.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/gcc/tree-diagnostic.c b/gcc/tree-diagnostic.c
index efd8a82fe418..8422714aecbc 100644
--- a/gcc/tree-diagnostic.c
+++ b/gcc/tree-diagnostic.c
@@ -96,9 +96,8 @@ struct loc_map_pair
unwound macro expansion trace. That's the part generated by this
function. */
-static void
+void
maybe_unwind_expanded_macro_loc (diagnostic_context *context,
- const diagnostic_info *diagnostic,
location_t where)
{
const struct line_map *map;
@@ -106,6 +105,8 @@ maybe_unwind_expanded_macro_loc (diagnostic_context *context,
unsigned ix;
loc_map_pair loc, *iter;
+ const location_t original_loc = where;
+
map = linemap_lookup (line_table, where);
if (!linemap_macro_expansion_map_p (map))
return;
@@ -142,7 +143,7 @@ maybe_unwind_expanded_macro_loc (diagnostic_context *context,
first macro which expansion triggered this trace was expanded
inside a system header. */
int saved_location_line =
- expand_location_to_spelling_point (diagnostic_location (diagnostic)).line;
+ expand_location_to_spelling_point (original_loc).line;
if (!LINEMAP_SYSP (ord_map))
FOR_EACH_VEC_ELT (loc_vec, ix, iter)
@@ -238,8 +239,7 @@ void
virt_loc_aware_diagnostic_finalizer (diagnostic_context *context,
diagnostic_info *diagnostic)
{
- maybe_unwind_expanded_macro_loc (context, diagnostic,
- diagnostic_location (diagnostic));
+ maybe_unwind_expanded_macro_loc (context, diagnostic_location (diagnostic));
}
/* Default tree printer. Handles declarations only. */
@@ -312,4 +312,6 @@ tree_diagnostics_defaults (diagnostic_context *context)
diagnostic_starter (context) = default_tree_diagnostic_starter;
diagnostic_finalizer (context) = default_diagnostic_finalizer;
diagnostic_format_decoder (context) = default_tree_printer;
+ context->print_path = default_tree_diagnostic_path_printer;
+ context->make_json_for_path = default_tree_make_json_for_path;
}