return label_text::borrow (m_desc);
}
-/* class custom_event : public checker_event. */
+/* class precanned_custom_event : public custom_event. */
/* Implementation of diagnostic_event::get_desc vfunc for
- custom_event.
+ precanned_custom_event.
Use the saved string as the event's description. */
label_text
-custom_event::get_desc (bool) const
+precanned_custom_event::get_desc (bool) const
{
return label_text::borrow (m_desc);
}
checker_event
debug_event (EK_DEBUG)
custom_event (EK_CUSTOM)
+ precanned_custom_event
statement_event (EK_STMT)
function_entry_event (EK_FUNCTION_ENTRY)
state_change_event (EK_STATE_CHANGE)
char *m_desc;
};
-/* A concrete event subclass for custom events. These are not filtered,
+/* An abstract 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
{
+protected:
+ custom_event (location_t loc, tree fndecl, int depth)
+ : checker_event (EK_CUSTOM, loc, fndecl, depth)
+ {
+ }
+};
+
+/* A concrete custom_event subclass with a precanned message. */
+
+class precanned_custom_event : public custom_event
+{
public:
- custom_event (location_t loc, tree fndecl, int depth,
- const char *desc)
- : checker_event (EK_CUSTOM, loc, fndecl, depth),
+ precanned_custom_event (location_t loc, tree fndecl, int depth,
+ const char *desc)
+ : custom_event (loc, fndecl, depth),
m_desc (xstrdup (desc))
{
}
- ~custom_event ()
+ ~precanned_custom_event ()
{
free (m_desc);
}
"this path would have been rejected as infeasible"
" at this edge: ");
pb.get_feasibility_problem ()->dump_to_pp (&pp);
- emission_path->add_event (new custom_event
+ emission_path->add_event (new precanned_custom_event
(dst_point.get_location (),
dst_point.get_fndecl (),
dst_stack_depth,
{
/* Compare with diagnostic_manager::add_events_for_superedge. */
const int src_stack_depth = src_point.get_stack_depth ();
- m_stack_pop_event = new custom_event
+ m_stack_pop_event = new precanned_custom_event
(src_point.get_location (),
src_point.get_fndecl (),
src_stack_depth,
FINAL OVERRIDE
{
emission_path->add_event
- (new custom_event (UNKNOWN_LOCATION, NULL_TREE, 0,
- "later on,"
- " when the signal is delivered to the process"));
+ (new precanned_custom_event
+ (UNKNOWN_LOCATION, NULL_TREE, 0,
+ "later on,"
+ " when the signal is delivered to the process"));
}
};