if (access->mode == access_write_only
|| access->mode == access_read_write)
{
- /* Subclass of decorated_region_model_context that
+ /* Subclass of annotating_context that
adds a note about the attr access to any saved diagnostics. */
- class annotating_ctxt : public note_adding_context
+ class annotating_ctxt : public annotating_context
{
public:
annotating_ctxt (tree callee_fndecl,
const attr_access &access,
region_model_context *ctxt)
- : note_adding_context (ctxt),
+ : annotating_context (ctxt),
m_callee_fndecl (callee_fndecl),
m_access (access)
{
}
- std::unique_ptr<pending_note> make_note () final override
+ void add_annotations () final override
{
- return make_unique<reason_attr_access>
- (m_callee_fndecl, m_access);
+ add_note (make_unique<reason_attr_access>
+ (m_callee_fndecl, m_access));
}
private:
tree m_callee_fndecl;
region_model_context *m_inner;
};
-/* Subclass of region_model_context_decorator that adds a note
- when saving diagnostics. */
+/* Subclass of region_model_context_decorator with a hook for adding
+ notes/events when saving diagnostics. */
-class note_adding_context : public region_model_context_decorator
+class annotating_context : public region_model_context_decorator
{
public:
bool warn (std::unique_ptr<pending_diagnostic> d) override
{
if (m_inner->warn (std::move (d)))
{
- add_note (make_note ());
+ add_annotations ();
return true;
}
else
return false;
}
- /* Hook to make the new note. */
- virtual std::unique_ptr<pending_note> make_note () = 0;
+ /* Hook to add new event(s)/note(s) */
+ virtual void add_annotations () = 0;
protected:
- note_adding_context (region_model_context *inner)
+ annotating_context (region_model_context *inner)
: region_model_context_decorator (inner)
{
}