diff --git a/dcalc/CcsCeffDelayCalc.cc b/dcalc/CcsCeffDelayCalc.cc index fbd331a4..cab8e115 100644 --- a/dcalc/CcsCeffDelayCalc.cc +++ b/dcalc/CcsCeffDelayCalc.cc @@ -314,7 +314,7 @@ CcsCeffDelayCalc::makeResult(const LibertyLibrary *drvr_library, dcalc_result.setGateDelay(gate_delay); dcalc_result.setDrvrSlew(drvr_slew); - for (const auto [load_pin, load_idx] : load_pin_index_map) { + for (const auto &[load_pin, load_idx] : load_pin_index_map) { ArcDelay wire_delay; Slew load_slew; loadDelaySlew(load_pin, drvr_library, rf, drvr_slew, wire_delay, load_slew); @@ -452,9 +452,9 @@ CcsCeffDelayCalc::findVlTime(double v, double t_init = region_ramp_times_[0]; double t_final = region_ramp_times_[region_count_]; bool root_fail = false; - double time = findRoot([=] (double t, - double &y, - double &dy) { + double time = findRoot([&] (double t, + double &y, + double &dy) { vl(t, elmore, y, dy); y -= v; }, t_init, t_final + elmore * 3.0, .001, 20, root_fail); diff --git a/dcalc/DmpCeff.cc b/dcalc/DmpCeff.cc index c75b4990..c00f85aa 100644 --- a/dcalc/DmpCeff.cc +++ b/dcalc/DmpCeff.cc @@ -343,7 +343,7 @@ DmpAlg::findDriverParams(double ceff) x_[DmpParam::dt] = dt; x_[DmpParam::t0] = t0; newtonRaphson(100, x_, nr_order_, driver_param_tol, - [=] () { evalDmpEqns(); }, + [this] () { evalDmpEqns(); }, fvec_, fjac_, index_, p_, scale_); t0_ = x_[DmpParam::t0]; dt_ = x_[DmpParam::dt]; @@ -494,7 +494,7 @@ DmpAlg::findVoCrossing(double vth, double t_lower, double t_upper) { - FindRootFunc vo_func = [=] (double t, + FindRootFunc vo_func = [&] (double t, double &y, double &dy) { double vo, vo_dt; @@ -612,7 +612,7 @@ DmpAlg::findVlCrossing(double vth, double t_lower, double t_upper) { - FindRootFunc vl_func = [=] (double t, + FindRootFunc vl_func = [&] (double t, double &y, double &dy) { double vl, vl_dt; diff --git a/dcalc/ParallelDelayCalc.cc b/dcalc/ParallelDelayCalc.cc index 2648797c..a27f65b9 100644 --- a/dcalc/ParallelDelayCalc.cc +++ b/dcalc/ParallelDelayCalc.cc @@ -86,7 +86,7 @@ ParallelDelayCalc::gateDelaysParallel(ArcDcalcArgSeq &dcalc_args, slew_sum += 1.0 / drvr_slew; dcalc_result.setLoadCount(load_pin_index_map.size()); - for (const auto [load_pin, load_idx] : load_pin_index_map) { + for (const auto &[load_pin, load_idx] : load_pin_index_map) { dcalc_result.setWireDelay(load_idx, gate_result.wireDelay(load_idx)); dcalc_result.setLoadSlew(load_idx, gate_result.loadSlew(load_idx)); } diff --git a/include/sta/ConcreteLibrary.hh b/include/sta/ConcreteLibrary.hh index bacd91a0..7cf72ee6 100644 --- a/include/sta/ConcreteLibrary.hh +++ b/include/sta/ConcreteLibrary.hh @@ -38,7 +38,7 @@ class LibertyCell; class LibertyPort; typedef Map ConcreteCellMap; -typedef Map AttributeMap; +typedef std::map AttributeMap; typedef Vector ConcretePortSeq; typedef Map ConcretePortMap; typedef ConcreteCellMap::ConstIterator ConcreteLibraryCellIterator; diff --git a/include/sta/ConcreteNetwork.hh b/include/sta/ConcreteNetwork.hh index 7c62a4f7..69b7d188 100644 --- a/include/sta/ConcreteNetwork.hh +++ b/include/sta/ConcreteNetwork.hh @@ -38,7 +38,7 @@ class ConcreteBindingTbl; class ConcreteLibertyLibraryIterator; typedef Vector ConcreteLibrarySeq; -typedef Map AttributeMap; +typedef std::map AttributeMap; typedef Map ConcreteLibraryMap; typedef ConcreteLibrarySeq::ConstIterator ConcreteLibraryIterator; typedef Map + namespace sta { +using std::string; + class Unit { public: Unit(const char *suffix); - ~Unit(); Unit(float scale, const char *suffix, int digits); @@ -34,9 +37,9 @@ public: float scale() const { return scale_; } void setScale(float scale); const char *scaleAbbreviation() const; - const char *suffix() const { return suffix_; } + const char *suffix() const { return suffix_.c_str(); } // scale abbreviation + suffix - const char *scaledSuffix() const { return scaled_suffix_; } + const char *scaledSuffix() const { return scaled_suffix_.c_str(); } void setSuffix(const char *suffix); int digits() const { return digits_; } void setDigits(int digits); @@ -51,8 +54,8 @@ private: void setScaledSuffix(); float scale_; // multiplier from user units to internal units - const char *suffix_; // print suffix - const char *scaled_suffix_; + string suffix_; // print suffix + string scaled_suffix_; int digits_; // print digits (after decimal pt) }; diff --git a/liberty/Units.cc b/liberty/Units.cc index 9b24173c..4874c19b 100644 --- a/liberty/Units.cc +++ b/liberty/Units.cc @@ -29,8 +29,7 @@ using std::abs; Unit::Unit(const char *suffix) : scale_(1.0), - suffix_(stringCopy(suffix)), - scaled_suffix_(nullptr), + suffix_(suffix), digits_(3) { setScaledSuffix(); @@ -40,8 +39,7 @@ Unit::Unit(float scale, const char *suffix, int digits) : scale_(scale), - suffix_(stringCopy(suffix)), - scaled_suffix_(nullptr), + suffix_(suffix), digits_(digits) { setScaledSuffix(); @@ -50,24 +48,15 @@ Unit::Unit(float scale, void Unit::setScaledSuffix() { - stringDelete(scaled_suffix_); - scaled_suffix_ = stringPrint("%s%s", scaleAbbreviation(), suffix_); -} - -Unit::~Unit() -{ - stringDelete(suffix_); - stringDelete(scaled_suffix_); + scaled_suffix_ = scaleAbbreviation() + suffix_; } void Unit::operator=(const Unit &unit) { scale_ = unit.scale_; - stringDelete(suffix_); - suffix_ = stringCopy(unit.suffix_); - stringDelete(scaled_suffix_); - scaled_suffix_ = stringCopy(unit.scaled_suffix_); + suffix_ = unit.suffix_; + scaled_suffix_ = unit.scaled_suffix_; digits_ = unit.digits_; } @@ -116,8 +105,7 @@ Unit::scaleAbbreviation() const void Unit::setSuffix(const char *suffix) { - stringDelete(suffix_); - suffix_ = stringCopy(suffix); + suffix_ = suffix; setScaledSuffix(); } diff --git a/network/ConcreteLibrary.cc b/network/ConcreteLibrary.cc index 820f9206..9cfca944 100644 --- a/network/ConcreteLibrary.cc +++ b/network/ConcreteLibrary.cc @@ -272,15 +272,15 @@ void ConcreteCell::setAttribute(const string &key, const string &value) { - attribute_map_.insert(key, value); + attribute_map_[key] = value; } string ConcreteCell::getAttribute(const string &key) const { - if (attribute_map_.hasKey(key)) { - return attribute_map_.findKey(key); - } + const auto &itr = attribute_map_.find(key); + if (itr != attribute_map_.end()) + return itr->second; return ""; } diff --git a/network/ConcreteNetwork.cc b/network/ConcreteNetwork.cc index c6c3cd00..456c3bca 100644 --- a/network/ConcreteNetwork.cc +++ b/network/ConcreteNetwork.cc @@ -1686,15 +1686,15 @@ void ConcreteInstance::setAttribute(const string &key, const string &value) { - attribute_map_.insert(key, value); + attribute_map_[key] = value; } string ConcreteInstance::getAttribute(const string &key) const { - if (attribute_map_.hasKey(key)) { - return attribute_map_.findKey(key); - } + const auto &itr = attribute_map_.find(key); + if (itr != attribute_map_.end()) + return itr->second; return ""; } diff --git a/search/Bfs.cc b/search/Bfs.cc index cdb6d3a7..62d26196 100644 --- a/search/Bfs.cc +++ b/search/Bfs.cc @@ -193,7 +193,7 @@ BfsIterator::visitParallel(Level to_level, for (size_t k = 0; k < thread_count; k++) { // Last thread gets the left overs. size_t to = (k == thread_count - 1) ? vertex_count : from + chunk_size; - dispatch_queue_->dispatch( [=](int) { + dispatch_queue_->dispatch( [&](int) { for (size_t i = from; i < to; i++) { Vertex *vertex = level_vertices[i]; if (vertex) {