aboutsummaryrefslogtreecommitdiffstats
path: root/backends/rtlil/rtlil_backend.cc
diff options
context:
space:
mode:
authorMiodrag Milanovic <mmicko@gmail.com>2023-01-17 12:58:08 +0100
committerMiodrag Milanovic <mmicko@gmail.com>2023-01-17 12:58:08 +0100
commit6574553189fb6ccb5d00a0c043671a625672b3d3 (patch)
tree57e3212ee75493d9f4939c9f9029b95880367a76 /backends/rtlil/rtlil_backend.cc
parent956c4e485a9463863f60c4dd03372db3fa8332a4 (diff)
downloadyosys-6574553189fb6ccb5d00a0c043671a625672b3d3.tar.gz
yosys-6574553189fb6ccb5d00a0c043671a625672b3d3.tar.bz2
yosys-6574553189fb6ccb5d00a0c043671a625672b3d3.zip
Fixes for some of clang scan-build detected issues
Diffstat (limited to 'backends/rtlil/rtlil_backend.cc')
-rw-r--r--backends/rtlil/rtlil_backend.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/backends/rtlil/rtlil_backend.cc b/backends/rtlil/rtlil_backend.cc
index b5163aefe..7c7e26a93 100644
--- a/backends/rtlil/rtlil_backend.cc
+++ b/backends/rtlil/rtlil_backend.cc
@@ -530,8 +530,9 @@ struct DumpPass : public Pass {
std::ostream *f;
std::stringstream buf;
+ bool empty = filename.empty();
- if (!filename.empty()) {
+ if (!empty) {
rewrite_filename(filename);
std::ofstream *ff = new std::ofstream;
ff->open(filename.c_str(), append ? std::ofstream::app : std::ofstream::trunc);
@@ -546,7 +547,7 @@ struct DumpPass : public Pass {
RTLIL_BACKEND::dump_design(*f, design, true, flag_m, flag_n);
- if (!filename.empty()) {
+ if (!empty) {
delete f;
} else {
log("%s", buf.str().c_str());