Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu.
Pushed to trunk as r15-6095-gf102b82d3da6dd.

gcc/ChangeLog:
        PR sarif-replay/117944
        * libsarifreplay.cc (sarif_replayer::handle_result_obj): Get any
        helpUri from the rule_obj and pass it to add_rule.

Signed-off-by: David Malcolm <dmalc...@redhat.com>
---
 gcc/libsarifreplay.cc | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/gcc/libsarifreplay.cc b/gcc/libsarifreplay.cc
index 9a053f7fe612..e8b5a55b9188 100644
--- a/gcc/libsarifreplay.cc
+++ b/gcc/libsarifreplay.cc
@@ -1004,7 +1004,20 @@ sarif_replayer::handle_result_obj (const json::object 
&result_obj,
   libgdiagnostics::group g (m_output_mgr);
   auto err (m_output_mgr.begin_diagnostic (level));
   if (rule_id)
-    err.add_rule (rule_id->get_string (), nullptr);
+    {
+      const char *url = nullptr;
+      if (rule_obj)
+       {
+         /* rule_obj should be a reportingDescriptor object (3.49).
+            Get any ยง3.49.12 helpUri property.  */
+         const property_spec_ref prop_help_uri
+           ("reportingDescriptor", "helpUri", "3.49.12");
+         if (auto url_val = get_optional_property<json::string>(*rule_obj,
+                                                                prop_help_uri))
+           url = url_val->get_string ();
+       }
+      err.add_rule (rule_id->get_string (), url);
+    }
   err.set_location (physical_loc);
   err.set_logical_location (logical_loc);
   if (path.m_inner)
-- 
2.26.3

Reply via email to