From a046a302f0d258dccc4fd22cb341f41bacf0aaba Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Tue, 18 Jun 2013 19:54:33 +0200 Subject: [PATCH] Fixed build with clang --- kernel/rtlil.h | 110 +++++++++++++++++++++++++++++++------------------ 1 file changed, 69 insertions(+), 41 deletions(-) diff --git a/kernel/rtlil.h b/kernel/rtlil.h index 695139244..5ababa7ec 100644 --- a/kernel/rtlil.h +++ b/kernel/rtlil.h @@ -239,16 +239,8 @@ struct RTLIL::Module { void add(RTLIL::Cell *cell); void fixup_ports(); - template void rewrite_sigspecs(T functor) { - for (auto &it : cells) - it.second->rewrite_sigspecs(functor); - for (auto &it : processes) - it.second->rewrite_sigspecs(functor); - for (auto &it : connections) { - functor(it.first); - functor(it.second); - } - } + template + void rewrite_sigspecs(T functor); }; struct RTLIL::Wire { @@ -274,10 +266,8 @@ struct RTLIL::Cell { std::map parameters; void optimize(); - template void rewrite_sigspecs(T functor) { - for (auto &it : connections) - functor(it.second); - } + template + void rewrite_sigspecs(T functor); }; struct RTLIL::SigChunk { @@ -346,16 +336,8 @@ struct RTLIL::CaseRule { ~CaseRule(); void optimize(); - template void rewrite_sigspecs(T functor) { - for (auto &it : compare) - functor(it); - for (auto &it : actions) { - functor(it.first); - functor(it.second); - } - for (auto it : switches) - it->rewrite_sigspecs(functor); - } + template + void rewrite_sigspecs(T functor); }; struct RTLIL::SwitchRule { @@ -365,11 +347,8 @@ struct RTLIL::SwitchRule { ~SwitchRule(); void optimize(); - template void rewrite_sigspecs(T functor) { - functor(signal); - for (auto it : cases) - it->rewrite_sigspecs(functor); - } + template + void rewrite_sigspecs(T functor); }; struct RTLIL::SyncRule { @@ -378,13 +357,8 @@ struct RTLIL::SyncRule { std::vector actions; void optimize(); - template void rewrite_sigspecs(T functor) { - functor(signal); - for (auto &it : actions) { - functor(it.first); - functor(it.second); - } - } + template + void rewrite_sigspecs(T functor); }; struct RTLIL::Process { @@ -395,11 +369,65 @@ struct RTLIL::Process { ~Process(); void optimize(); - template void rewrite_sigspecs(T functor) { - root_case.rewrite_sigspecs(functor); - for (auto it : syncs) - it->rewrite_sigspecs(functor); - } + template + void rewrite_sigspecs(T functor); }; +template +void RTLIL::Module::rewrite_sigspecs(T functor) +{ + for (auto &it : cells) + it.second->rewrite_sigspecs(functor); + for (auto &it : processes) + it.second->rewrite_sigspecs(functor); + for (auto &it : connections) { + functor(it.first); + functor(it.second); + } +} + +template +void RTLIL::Cell::rewrite_sigspecs(T functor) { + for (auto &it : connections) + functor(it.second); +} + +template +void RTLIL::CaseRule::rewrite_sigspecs(T functor) { + for (auto &it : compare) + functor(it); + for (auto &it : actions) { + functor(it.first); + functor(it.second); + } + for (auto it : switches) + it->rewrite_sigspecs(functor); +} + +template +void RTLIL::SwitchRule::rewrite_sigspecs(T functor) +{ + functor(signal); + for (auto it : cases) + it->rewrite_sigspecs(functor); +} + +template +void RTLIL::SyncRule::rewrite_sigspecs(T functor) +{ + functor(signal); + for (auto &it : actions) { + functor(it.first); + functor(it.second); + } +} + +template +void RTLIL::Process::rewrite_sigspecs(T functor) +{ + root_case.rewrite_sigspecs(functor); + for (auto it : syncs) + it->rewrite_sigspecs(functor); +} + #endif -- 2.30.2