From 464bc3ae4ff6f0d980ea31937f45a3425e97122f Mon Sep 17 00:00:00 2001 From: James Cherry Date: Wed, 18 Mar 2026 13:01:05 -0700 Subject: [PATCH] Report use string instead of string_view Signed-off-by: James Cherry --- include/sta/Report.hh | 6 +++--- include/sta/ReportTcl.hh | 6 +++--- liberty/LibertyScanner.hh | 2 -- util/Report.cc | 21 +++++++++------------ util/ReportTcl.cc | 6 +++--- 5 files changed, 18 insertions(+), 23 deletions(-) diff --git a/include/sta/Report.hh b/include/sta/Report.hh index fb42f00b..7e9aab55 100644 --- a/include/sta/Report.hh +++ b/include/sta/Report.hh @@ -138,13 +138,13 @@ public: } // Log output to filename until logEnd is called. - virtual void logBegin(std::string_view filename); + virtual void logBegin(std::string filename); virtual void logEnd(); // Redirect output to filename until redirectFileEnd is called. - virtual void redirectFileBegin(std::string_view filename); + virtual void redirectFileBegin(std::string filename); // Redirect append output to filename until redirectFileEnd is called. - virtual void redirectFileAppendBegin(std::string_view filename); + virtual void redirectFileAppendBegin(std::string filename); virtual void redirectFileEnd(); // Redirect output to a string until redirectStringEnd is called. virtual void redirectStringBegin(); diff --git a/include/sta/ReportTcl.hh b/include/sta/ReportTcl.hh index 5f4a6cd0..acdf84dc 100644 --- a/include/sta/ReportTcl.hh +++ b/include/sta/ReportTcl.hh @@ -44,10 +44,10 @@ class ReportTcl : public Report public: ReportTcl(); virtual ~ReportTcl(); - void logBegin(std::string_view filename) override; + void logBegin(std::string filename) override; void logEnd() override; - void redirectFileBegin(std::string_view filename) override; - void redirectFileAppendBegin(std::string_view filename) override; + void redirectFileBegin(std::string filename) override; + void redirectFileAppendBegin(std::string filename) override; void redirectFileEnd() override; void redirectStringBegin() override; const char *redirectStringEnd() override; diff --git a/liberty/LibertyScanner.hh b/liberty/LibertyScanner.hh index a649f514..3623940c 100644 --- a/liberty/LibertyScanner.hh +++ b/liberty/LibertyScanner.hh @@ -27,8 +27,6 @@ #include #include -#include "LibertyParser.hh" -#include "LibertyLocation.hh" #include "LibertyParse.hh" #ifndef __FLEX_LEXER_H diff --git a/util/Report.cc b/util/Report.cc index d539c574..d8a6a04d 100644 --- a/util/Report.cc +++ b/util/Report.cc @@ -185,12 +185,11 @@ Report::isSuppressed(int id) //////////////////////////////////////////////////////////////// void -Report::logBegin(std::string_view filename) +Report::logBegin(std::string filename) { - std::string filename_str(filename); - log_stream_ = fopen(filename_str.c_str(), "w"); + log_stream_ = fopen(filename.c_str(), "w"); if (log_stream_ == nullptr) - throw FileNotWritable(std::move(filename_str)); + throw FileNotWritable(std::move(filename)); } void @@ -202,21 +201,19 @@ Report::logEnd() } void -Report::redirectFileBegin(std::string_view filename) +Report::redirectFileBegin(std::string filename) { - std::string filename_str(filename); - redirect_stream_ = fopen(filename_str.c_str(), "w"); + redirect_stream_ = fopen(filename.c_str(), "w"); if (redirect_stream_ == nullptr) - throw FileNotWritable(std::move(filename_str)); + throw FileNotWritable(std::move(filename)); } void -Report::redirectFileAppendBegin(std::string_view filename) +Report::redirectFileAppendBegin(std::string filename) { - std::string filename_str(filename); - redirect_stream_ = fopen(filename_str.c_str(), "a"); + redirect_stream_ = fopen(filename.c_str(), "a"); if (redirect_stream_ == nullptr) - throw FileNotWritable(std::move(filename_str)); + throw FileNotWritable(std::move(filename)); } void diff --git a/util/ReportTcl.cc b/util/ReportTcl.cc index a418a53a..97eef4af 100644 --- a/util/ReportTcl.cc +++ b/util/ReportTcl.cc @@ -183,7 +183,7 @@ ReportTcl::flush() // Tcl_Main can eval multiple commands before the flushing the command // output, so the log/redirect commands must force a flush. void -ReportTcl::logBegin(std::string_view filename) +ReportTcl::logBegin(std::string filename) { flush(); Report::logBegin(filename); @@ -197,14 +197,14 @@ ReportTcl::logEnd() } void -ReportTcl::redirectFileBegin(std::string_view filename) +ReportTcl::redirectFileBegin(std::string filename) { flush(); Report::redirectFileBegin(filename); } void -ReportTcl::redirectFileAppendBegin(std::string_view filename) +ReportTcl::redirectFileAppendBegin(std::string filename) { flush(); Report::redirectFileAppendBegin(filename);