@@ -44,6 +44,8 @@ event_kind_to_string (enum event_kind ek)
gcc_unreachable ();
case EK_DEBUG:
return "EK_DEBUG";
+ case EK_CUSTOM:
+ return "EK_CUSTOM";
case EK_STMT:
return "EK_STMT";
case EK_FUNCTION_ENTRY:
@@ -129,6 +131,20 @@ debug_event::get_desc (bool) const
////////////////////////////////////////////////////////////////////////////
+/* class custom_event : public checker_event. */
+
+/* Implementation of diagnostic_event::get_desc vfunc for
+ custom_event.
+ Use the saved string as the event's description. */
+
+label_text
+custom_event::get_desc (bool) const
+{
+ return label_text::borrow (m_desc);
+}
+
+////////////////////////////////////////////////////////////////////////////
+
/* class statement_event : public checker_event. */
/* statement_event's ctor. */
@@ -32,6 +32,7 @@ along with GCC; see the file COPYING3. If not see
enum event_kind
{
EK_DEBUG,
+ EK_CUSTOM,
EK_STMT,
EK_FUNCTION_ENTRY,
EK_STATE_CHANGE,
@@ -57,6 +58,7 @@ extern const char *event_kind_to_string (enum event_kind ek);
diagnostic_event
checker_event
debug_event (EK_DEBUG)
+ custom_event (EK_CUSTOM)
statement_event (EK_STMT)
function_entry_event (EK_FUNCTION_ENTRY)
state_change_event (EK_STATE_CHANGE)
@@ -142,6 +144,34 @@ private:
char *m_desc;
};
+/* A concrete event subclass for custom events. These are not filtered,
+ as they are likely to be pertinent to the diagnostic. */
+
+class custom_event : public checker_event
+{
+public:
+ custom_event (location_t loc, tree fndecl, int depth,
+ const char *desc)
+ : checker_event (EK_CUSTOM, loc, fndecl, depth),
+ m_desc (xstrdup (desc))
+ {
+ }
+ ~custom_event ()
+ {
+ free (m_desc);
+ }
+
+ label_text get_desc (bool) const FINAL OVERRIDE;
+
+ checker_event *clone () const FINAL OVERRIDE
+ {
+ return new custom_event (m_loc, m_fndecl, m_depth, m_desc);
+ }
+
+private:
+ char *m_desc;
+};
+
/* A concrete event subclass describing the execution of a gimple statement,
for use at high verbosity levels when debugging paths. */
@@ -919,6 +919,10 @@ diagnostic_manager::prune_path (checker_path *path,
}
break;
+ case EK_CUSTOM:
+ /* Don't filter custom events. */
+ break;
+
case EK_STMT:
{
/* If this stmt is the origin of "var", update var. */