Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu.
Successful run of analyzer integration tests on x86_64-pc-linux-gnu.
Pushed to trunk as r16-1630-g5a64c96cfe7a4d.

gcc/ChangeLog:
        PR other/116792
        * diagnostic-format-html.cc (html_token_printer::print_tokens):
        Handle pp_token::kind::event_id.
        (selftest::test_token_printer): Add coverage of printing an event
        id.
---
 gcc/diagnostic-format-html.cc | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/gcc/diagnostic-format-html.cc b/gcc/diagnostic-format-html.cc
index 45d088150dd..5668b50a91a 100644
--- a/gcc/diagnostic-format-html.cc
+++ b/gcc/diagnostic-format-html.cc
@@ -799,6 +799,16 @@ public:
        case pp_token::kind::end_url:
          m_xp.pop_tag ("a");
          break;
+
+       case pp_token::kind::event_id:
+         {
+           pp_token_event_id *sub = as_a <pp_token_event_id *> (iter);
+           gcc_assert (sub->m_event_id.known_p ());
+           m_xp.add_text ("(");
+           m_xp.add_text (std::to_string (sub->m_event_id.one_based ()));
+           m_xp.add_text (")");
+         }
+         break;
        }
   }
 
@@ -1375,6 +1385,15 @@ test_token_printer ()
        "&apos;"
        "</div>\n");
   }
+
+  {
+    token_printer_test t;
+    diagnostic_event_id_t event_id (0);
+    pp_printf (&t.m_pp, "foo %@ bar", &event_id);
+    ASSERT_XML_PRINT_EQ
+      (t.m_top_element,
+       "<div>foo (1) bar</div>\n");
+  }
 }
 
 /* A subclass of html_output_format for writing selftests.
-- 
2.49.0

Reply via email to