aboutsummaryrefslogtreecommitdiff
path: root/gcc/diagnostic-format-json.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/diagnostic-format-json.cc')
-rw-r--r--gcc/diagnostic-format-json.cc13
1 files changed, 8 insertions, 5 deletions
diff --git a/gcc/diagnostic-format-json.cc b/gcc/diagnostic-format-json.cc
index c28804e..205678d 100644
--- a/gcc/diagnostic-format-json.cc
+++ b/gcc/diagnostic-format-json.cc
@@ -31,6 +31,7 @@ along with GCC; see the file COPYING3. If not see
#include "diagnostic-buffer.h"
#include "json.h"
#include "selftest.h"
+#include "diagnostic-client-data-hooks.h"
#include "logical-location.h"
class json_output_format;
@@ -272,11 +273,13 @@ make_json_for_path (diagnostic_context &context,
auto pp = ref_pp->clone ();
event.print_desc (*pp.get ());
event_obj->set_string ("description", pp_formatted_text (pp.get ()));
- if (const logical_location *logical_loc = event.get_logical_location ())
- {
- label_text name (logical_loc->get_name_for_path_output ());
- event_obj->set_string ("function", name.get ());
- }
+ if (logical_location logical_loc = event.get_logical_location ())
+ if (auto hooks = context.get_client_data_hooks ())
+ if (auto mgr = hooks->get_logical_location_manager ())
+ {
+ label_text name (mgr->get_name_for_path_output (logical_loc));
+ event_obj->set_string ("function", name.get ());
+ }
event_obj->set_integer ("depth", event.get_stack_depth ());
path_array->append (std::move (event_obj));
}