diff --git a/include/sta/Sta.hh b/include/sta/Sta.hh index cb23b74e..483b3a00 100644 --- a/include/sta/Sta.hh +++ b/include/sta/Sta.hh @@ -79,7 +79,7 @@ class GraphLoop; using ModeNameMap = std::map; using SceneNameMap = std::map; using SlowDrvrIterator = Iterator; -using CheckError = StringSeq; +using CheckError = StdStringSeq; using CheckErrorSeq = std::vector; enum class CmdNamespace { sta, sdc }; using ParasiticsNameMap = std::map; diff --git a/liberty/LibertyReaderPvt.hh b/liberty/LibertyReaderPvt.hh index bbfabaf8..ec8facff 100644 --- a/liberty/LibertyReaderPvt.hh +++ b/liberty/LibertyReaderPvt.hh @@ -31,7 +31,6 @@ #include #include -#include "StringSeq.hh" #include "StringUtil.hh" #include "MinMax.hh" #include "NetworkClass.hh" diff --git a/search/CheckTiming.cc b/search/CheckTiming.cc index f05de24e..965a8d15 100644 --- a/search/CheckTiming.cc +++ b/search/CheckTiming.cc @@ -24,7 +24,6 @@ #include "CheckTiming.hh" -#include "ContainerHelpers.hh" #include "Error.hh" #include "TimingRole.hh" #include "Network.hh" @@ -64,7 +63,6 @@ void CheckTiming::deleteErrors() { for (CheckError *error : errors_) { - deleteContents(error); delete error; } } @@ -204,25 +202,23 @@ CheckTiming::checkLoops() errorMsgSubst("Warning: There %is %d combinational loop%s in the design.", loop_count, error_msg); CheckError *error = new CheckError; - error->push_back(stringCopy(error_msg.c_str())); + error->push_back(error_msg); for (GraphLoop *loop : loops) { if (loop->isCombinational()) { Edge *last_edge = nullptr; for (Edge *edge : *loop->edges()) { Pin *pin = edge->from(graph_)->pin(); - const char *pin_name = stringCopy(sdc_network_->pathName(pin)); - error->push_back(pin_name); + error->push_back(sdc_network_->pathName(pin)); last_edge = edge; } if (last_edge) { - error->push_back(stringCopy("| loop cut point")); + error->push_back("| loop cut point"); const Pin *pin = last_edge->to(graph_)->pin(); - const char *pin_name = stringCopy(sdc_network_->pathName(pin)); - error->push_back(pin_name); + error->push_back(sdc_network_->pathName(pin)); // Separator between loops. - error->push_back(stringCopy("--------------------------------")); + error->push_back("--------------------------------"); } } } @@ -362,15 +358,12 @@ CheckTiming::pushPinErrors(const char *msg, CheckError *error = new CheckError; std::string error_msg; errorMsgSubst(msg, pins.size(), error_msg); - // Copy the error strings because the error deletes them when it - // is deleted. - error->push_back(stringCopy(error_msg.c_str())); + error->push_back(error_msg); // Sort the error pins so the output is independent of the order // the the errors are discovered. PinSeq pins1 = sortByPathName(&pins, network_); for (const Pin *pin : pins1) { - const char *pin_name = stringCopy(sdc_network_->pathName(pin)); - error->push_back(pin_name); + error->push_back(sdc_network_->pathName(pin)); } errors_.push_back(error); } @@ -384,15 +377,12 @@ CheckTiming::pushClkErrors(const char *msg, CheckError *error = new CheckError; std::string error_msg; errorMsgSubst(msg, clks.size(), error_msg); - // Copy the error strings because the error deletes them when it - // is deleted. - error->push_back(stringCopy(error_msg.c_str())); + error->push_back(error_msg); // Sort the error clks so the output is independent of the order // the the errors are discovered. ClockSeq clks1 = sortByName(&clks); for (const Clock *clk : clks1) { - const char *clk_name = stringCopy(clk->name()); - error->push_back(clk_name); + error->push_back(clk->name()); } errors_.push_back(error); } diff --git a/search/CheckTiming.hh b/search/CheckTiming.hh index 26edc150..f2c821c7 100644 --- a/search/CheckTiming.hh +++ b/search/CheckTiming.hh @@ -26,7 +26,7 @@ #include -#include "StringSeq.hh" +#include "StringUtil.hh" #include "NetworkClass.hh" #include "GraphClass.hh" #include "SdcClass.hh" @@ -36,7 +36,7 @@ namespace sta { class ClkNetwork; -using CheckError = StringSeq; +using CheckError = StdStringSeq; using CheckErrorSeq = std::vector; class CheckTiming : public StaState diff --git a/tcl/StaTclTypes.i b/tcl/StaTclTypes.i index 270aad83..b1c7b288 100644 --- a/tcl/StaTclTypes.i +++ b/tcl/StaTclTypes.i @@ -1137,10 +1137,9 @@ using namespace sta; CheckErrorSeq *check_errors = $1; for (CheckError *error : *check_errors) { Tcl_Obj *string_list = Tcl_NewListObj(0, nullptr); - for (const char *str : *error) { - size_t str_len = strlen(str); - Tcl_Obj *obj = Tcl_NewStringObj(const_cast(str), - static_cast(str_len)); + for (const std::string &str : *error) { + Tcl_Obj *obj = Tcl_NewStringObj(str.c_str(), + static_cast(str.size())); Tcl_ListObjAppendElement(interp, string_list, obj); } Tcl_ListObjAppendElement(interp, error_list, string_list);