public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-9900] analyzer: add SARIF property bag to -Wanalyzer-infinite-recursion
@ 2024-04-10 20:47 David Malcolm
  0 siblings, 0 replies; only message in thread
From: David Malcolm @ 2024-04-10 20:47 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:960e07d73a5295adf059053907bcb395115606d2

commit r14-9900-g960e07d73a5295adf059053907bcb395115606d2
Author: David Malcolm <dmalcolm@redhat.com>
Date:   Wed Apr 10 16:43:29 2024 -0400

    analyzer: add SARIF property bag to -Wanalyzer-infinite-recursion
    
    gcc/analyzer/ChangeLog:
            * infinite-recursion.cc: Include "diagnostic-format-sarif.h".
            (infinite_recursion_diagnostic::maybe_add_sarif_properties): New.
    
    Signed-off-by: David Malcolm <dmalcolm@redhat.com>

Diff:
---
 gcc/analyzer/infinite-recursion.cc | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/gcc/analyzer/infinite-recursion.cc b/gcc/analyzer/infinite-recursion.cc
index 112e4bd08f2..65f136ddad6 100644
--- a/gcc/analyzer/infinite-recursion.cc
+++ b/gcc/analyzer/infinite-recursion.cc
@@ -62,6 +62,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "make-unique.h"
 #include "analyzer/checker-path.h"
 #include "analyzer/feasible-graph.h"
+#include "diagnostic-format-sarif.h"
 
 /* A subclass of pending_diagnostic for complaining about suspected
    infinite recursion.  */
@@ -236,6 +237,18 @@ public:
     return false;
   }
 
+  void maybe_add_sarif_properties (sarif_object &result_obj)
+    const final override
+  {
+    sarif_property_bag &props = result_obj.get_or_create_properties ();
+#define PROPERTY_PREFIX "gcc/analyzer/infinite_recursion_diagnostic/"
+    props.set_integer (PROPERTY_PREFIX "prev_entry_enode",
+		       m_prev_entry_enode->m_index);
+    props.set_integer (PROPERTY_PREFIX "new_entry_enode",
+		       m_new_entry_enode->m_index);
+#undef PROPERTY_PREFIX
+  }
+
 private:
   /* Return true iff control flow along FEDGE was affected by
      a conjured_svalue.  */

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-04-10 20:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-10 20:47 [gcc r14-9900] analyzer: add SARIF property bag to -Wanalyzer-infinite-recursion David Malcolm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).