From: Clifford Wolf Date: Thu, 31 Mar 2016 07:57:44 +0000 (+0200) Subject: Added log_dump() support for dict<> and pool<> containers X-Git-Tag: yosys-0.7~274 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6f1b6dc322bf6cceeadef7c666b8ff333ec6f2bf;p=yosys.git Added log_dump() support for dict<> and pool<> containers --- diff --git a/kernel/log.h b/kernel/log.h index 28baf9886..c0be23b08 100644 --- a/kernel/log.h +++ b/kernel/log.h @@ -230,6 +230,32 @@ static inline void log_dump_args_worker(const char *p YS_ATTRIBUTE(unused)) { lo void log_dump_val_worker(RTLIL::IdString v); void log_dump_val_worker(RTLIL::SigSpec v); +template +static inline void log_dump_val_worker(dict &v) { + log("{"); + bool first = true; + for (auto &it : v) { + log(first ? " " : ", "); + log_dump_val_worker(it.first); + log(": "); + log_dump_val_worker(it.second); + first = false; + } + log(" }"); +} + +template +static inline void log_dump_val_worker(pool &v) { + log("{"); + bool first = true; + for (auto &it : v) { + log(first ? " " : ", "); + log_dump_val_worker(it); + first = false; + } + log(" }"); +} + template static inline void log_dump_val_worker(T *ptr) { log("%p", ptr); }