From 287614186a2d25eb0d59d8978f308e1a8922ce3d Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Fri, 2 Nov 2018 15:02:47 -0700 Subject: [PATCH] systemc: Move a function after the class it uses internally. The class was defined, but only later in the file. By putting the function definition later, clang stops reporting an error. Change-Id: Id4dd1ec3f3a06f4d1dc10ef4ff8c545d98a6ae12 Reviewed-on: https://gem5-review.googlesource.com/c/13877 Reviewed-by: Gabe Black Maintainer: Gabe Black --- src/systemc/ext/core/sc_event.hh | 40 +++++++++++++++++++------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/src/systemc/ext/core/sc_event.hh b/src/systemc/ext/core/sc_event.hh index 56ee24f76..e2164f4b8 100644 --- a/src/systemc/ext/core/sc_event.hh +++ b/src/systemc/ext/core/sc_event.hh @@ -236,23 +236,9 @@ class sc_event_finder_t : public sc_event_finder virtual ~sc_event_finder_t() {} - const sc_port_base *port() const { return _port; } + const sc_port_base *port() const override { return _port; } - const sc_event & - find_event(sc_interface *if_p=NULL) const override - { - static const sc_gem5::InternalScEvent none; - const IF *iface = if_p ? dynamic_cast(if_p) : - dynamic_cast(_port->get_interface()); - if (!iface) { - std::ostringstream ss; - ss << "port is not bound: port '" << _port->name() << "' (" << - _port->kind() << ")"; - SC_REPORT_ERROR(SC_ID_FIND_EVENT_, ss.str().c_str()); - return none; - } - return (const_cast(iface)->*_method)(); - } + const sc_event &find_event(sc_interface *if_p=NULL) const override; private: const sc_port_b *_port; @@ -276,4 +262,26 @@ class InternalScEvent : public ::sc_core::sc_event } // namespace sc_gem5 +namespace sc_core +{ + +template +const sc_event & +sc_event_finder_t::find_event(sc_interface *if_p) const +{ + static const sc_gem5::InternalScEvent none; + const IF *iface = if_p ? dynamic_cast(if_p) : + dynamic_cast(_port->get_interface()); + if (!iface) { + std::ostringstream ss; + ss << "port is not bound: port '" << _port->name() << "' (" << + _port->kind() << ")"; + SC_REPORT_ERROR(SC_ID_FIND_EVENT_, ss.str().c_str()); + return none; + } + return (const_cast(iface)->*_method)(); +} + +} // namespace sc_core + #endif //__SYSTEMC_EXT_CORE_SC_INTERFACE_HH__ -- 2.30.2