https://gcc.gnu.org/g:20f9b31a2642a31249e649eb3005147a097b741c

commit r16-6179-g20f9b31a2642a31249e649eb3005147a097b741c
Author: David Malcolm <[email protected]>
Date:   Tue Dec 16 16:11:55 2025 -0500

    analyzer: escape filenames in supergraph dump
    
    gcc/analyzer/ChangeLog:
            * supergraph.cc (supernode::dump_dot): Escape filename.
    
    Signed-off-by: David Malcolm <[email protected]>

Diff:
---
 gcc/analyzer/supergraph.cc | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/gcc/analyzer/supergraph.cc b/gcc/analyzer/supergraph.cc
index f75fab1356db..0e28d4d9b349 100644
--- a/gcc/analyzer/supergraph.cc
+++ b/gcc/analyzer/supergraph.cc
@@ -847,8 +847,14 @@ supernode::dump_dot (graphviz_out *gv, const dump_args_t 
&args) const
 
          if ((exploc.file != prev_exploc.file)
              && exploc.file)
-           pp_printf (pp, "<TR><TD>%s:%i:</TD></TR>",
-                      exploc.file, exploc.line);
+           {
+             pp_string (pp, "<TR><TD>");
+             pp_flush (pp);
+             pp_printf (pp, "%s", exploc.file);
+             /* Escape, to handle cases like "<built-in>".  */
+             pp_write_text_as_html_like_dot_to_stream (pp);
+             pp_printf (pp, ":%i:</TD></TR>", exploc.line);
+           }
          if (exploc.line != prev_exploc.line)
            if (const diagnostics::char_span line
                = global_dc->get_file_cache ().get_source_line (exploc.file,

Reply via email to