]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/analyzer/sm-pattern-test.cc
Update copyright years.
[thirdparty/gcc.git] / gcc / analyzer / sm-pattern-test.cc
index 9b2ad68e26a76be9b7453c9e84375c36023ade44..866e07b43fb8dc9baddb8f73834758fe08b2ed7e 100644 (file)
@@ -1,7 +1,7 @@
 /* A state machine for use in DejaGnu tests, to check that
    pattern-matching works as expected.
 
-   Copyright (C) 2019-2022 Free Software Foundation, Inc.
+   Copyright (C) 2019-2024 Free Software Foundation, Inc.
    Contributed by David Malcolm <dmalcolm@redhat.com>.
 
 This file is part of GCC.
@@ -21,24 +21,21 @@ along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
 #include "config.h"
+#define INCLUDE_MEMORY
 #include "system.h"
 #include "coretypes.h"
+#include "make-unique.h"
 #include "tree.h"
 #include "function.h"
 #include "basic-block.h"
 #include "gimple.h"
 #include "tree-pretty-print.h"
 #include "diagnostic-path.h"
-#include "diagnostic-metadata.h"
-#include "function.h"
-#include "json.h"
 #include "analyzer/analyzer.h"
 #include "diagnostic-event-id.h"
 #include "analyzer/analyzer-logging.h"
 #include "analyzer/sm.h"
 #include "analyzer/pending-diagnostic.h"
-#include "tristate.h"
-#include "selftest.h"
 #include "analyzer/call-string.h"
 #include "analyzer/program-point.h"
 #include "analyzer/store.h"
@@ -94,11 +91,10 @@ public:
     return 0;
   }
 
-  bool emit (rich_location *rich_loc) final override
+  bool emit (diagnostic_emission_context &ctxt) final override
   {
-    return warning_at (rich_loc, get_controlling_option (),
-                      "pattern match on %<%E %s %E%>",
-                      m_lhs, op_symbol_code (m_op), m_rhs);
+    return ctxt.warn ("pattern match on %<%E %s %E%>",
+                     m_lhs, op_symbol_code (m_op), m_rhs);
   }
 
 private:
@@ -143,8 +139,8 @@ pattern_test_state_machine::on_condition (sm_context *sm_ctxt,
 
   if (tree lhs_expr = sm_ctxt->get_diagnostic_tree (lhs))
     {
-      pending_diagnostic *diag = new pattern_match (lhs_expr, op, rhs_cst);
-      sm_ctxt->warn (node, stmt, lhs_expr, diag);
+      sm_ctxt->warn (node, stmt, lhs_expr,
+                    make_unique<pattern_match> (lhs_expr, op, rhs_cst));
     }
 }