diff --git a/liberty/LibertyReader.cc b/liberty/LibertyReader.cc index 880a682e..156255ad 100644 --- a/liberty/LibertyReader.cc +++ b/liberty/LibertyReader.cc @@ -583,7 +583,7 @@ LibertyReader::endLibraryAttrs(LibertyGroup *group) // Default resistance_unit to pulling_resistance_unit. if (!have_resistance_unit_) { Units *units = library_->units(); - units->resistanceUnit()->copy(units->pullingResistanceUnit()); + *units->resistanceUnit() = *units->pullingResistanceUnit(); } // These attributes reference named groups in the library so diff --git a/liberty/Units.cc b/liberty/Units.cc index 42cda577..35815263 100644 --- a/liberty/Units.cc +++ b/liberty/Units.cc @@ -47,13 +47,12 @@ Unit::~Unit() } void -Unit::copy(const Unit *unit) +Unit::operator=(const Unit &unit) { - if (suffix_) - stringDelete(suffix_); - scale_ = unit->scale_; - suffix_ = stringCopy(unit->suffix_); - digits_ = unit->digits_; + scale_ = unit.scale_; + stringDelete(suffix_); + suffix_ = stringCopy(unit.suffix_); + digits_ = unit.digits_; } void @@ -65,8 +64,7 @@ Unit::setScale(float scale) void Unit::setSuffix(const char *suffix) { - if (suffix_) - stringDelete(suffix_); + stringDelete(suffix_); suffix_ = stringCopy(suffix); } @@ -134,16 +132,16 @@ Units::find(const char *unit_name) } void -Units::copy(const Units *units) +Units::operator=(const Units &units) { - time_unit_.copy(units->timeUnit()); - capacitance_unit_.copy(units->capacitanceUnit()); - resistance_unit_.copy(units->resistanceUnit()); - voltage_unit_.copy(units->voltageUnit()); - current_unit_.copy(units->currentUnit()); - power_unit_.copy(units->powerUnit()); - distance_unit_.copy(units->distanceUnit()); - scalar_unit_.copy(units->scalarUnit()); + time_unit_ = *units.timeUnit(); + capacitance_unit_ = *units.capacitanceUnit(); + resistance_unit_ = *units.resistanceUnit(); + voltage_unit_ = *units.voltageUnit(); + current_unit_ = *units.currentUnit(); + power_unit_ = *units.powerUnit(); + distance_unit_ = *units.distanceUnit(); + scalar_unit_ = *units.scalarUnit(); } } // namespace diff --git a/liberty/Units.hh b/liberty/Units.hh index ae2855e3..2d820cbf 100644 --- a/liberty/Units.hh +++ b/liberty/Units.hh @@ -17,8 +17,6 @@ #ifndef STA_UNITS_H #define STA_UNITS_H -#include "DisallowCopyAssign.hh" - namespace sta { class Unit @@ -29,7 +27,7 @@ public: Unit(float scale, const char *suffix, int digits); - void copy(const Unit *unit); + void operator=(const Unit &unit); float scale() const { return scale_; } void setScale(float scale); const char *suffix() const { return suffix_; } @@ -43,8 +41,6 @@ public: int digits) const; private: - DISALLOW_COPY_AND_ASSIGN(Unit); - float scale_; // multiplier from user units to internal units const char *suffix_; // print suffix int digits_; // print digits (after decimal pt) @@ -57,7 +53,7 @@ class Units public: Units() {} Unit *find(const char *unit_name); - void copy(const Units *units); + void operator=(const Units &units); Unit *timeUnit() { return &time_unit_; } const Unit *timeUnit() const { return &time_unit_; } Unit *capacitanceUnit() { return &capacitance_unit_; } @@ -78,8 +74,6 @@ public: const Unit *scalarUnit() const { return &scalar_unit_; } private: - DISALLOW_COPY_AND_ASSIGN(Units); - Unit time_unit_; Unit capacitance_unit_; Unit voltage_unit_; diff --git a/search/CheckMinPulseWidths.cc b/search/CheckMinPulseWidths.cc index df00ef43..7eef8360 100644 --- a/search/CheckMinPulseWidths.cc +++ b/search/CheckMinPulseWidths.cc @@ -358,7 +358,7 @@ MinPulseWidthCheck::closePath(const StaState *sta, if (tagMatchNoPathAp(close_path->tag(sta), &close_tag)) { debugPrint1(sta->debug(), "mpw", 3, " match %s\n", close_path->tag(sta)->asString(sta)); - close.copy(close_path); + close = close_path; break; } } diff --git a/search/ClkSkew.cc b/search/ClkSkew.cc index d6a268f0..a98c9e48 100644 --- a/search/ClkSkew.cc +++ b/search/ClkSkew.cc @@ -45,8 +45,8 @@ public: ClkSkew(PathVertex *src_path, PathVertex *tgt_path, StaState *sta); - ClkSkew(ClkSkew &clk_skew); - void copy(ClkSkew &clk_skew); + ClkSkew(const ClkSkew &clk_skew); + void operator=(const ClkSkew &clk_skew); PathVertex *srcPath() { return &src_path_; } PathVertex *tgtPath() { return &tgt_path_; } float srcLatency(StaState *sta); @@ -58,8 +58,6 @@ private: PathVertex src_path_; PathVertex tgt_path_; float skew_; - - DISALLOW_COPY_AND_ASSIGN(ClkSkew); }; ClkSkew::ClkSkew() : @@ -71,21 +69,23 @@ ClkSkew::ClkSkew(PathVertex *src_path, PathVertex *tgt_path, StaState *sta) { - src_path_.copy(src_path); - tgt_path_.copy(tgt_path); + src_path_ = src_path; + tgt_path_ = tgt_path; skew_ = srcLatency(sta) - tgtLatency(sta) - delayAsFloat(crpr(sta)); } -ClkSkew::ClkSkew(ClkSkew &clk_skew) +ClkSkew::ClkSkew(const ClkSkew &clk_skew) { - copy(clk_skew); + src_path_ = clk_skew.src_path_; + tgt_path_ = clk_skew.tgt_path_; + skew_ = clk_skew.skew_; } void -ClkSkew::copy(ClkSkew &clk_skew) +ClkSkew::operator=(const ClkSkew &clk_skew) { - src_path_.copy(clk_skew.src_path_); - tgt_path_.copy(clk_skew.tgt_path_); + src_path_ = clk_skew.src_path_; + tgt_path_ = clk_skew.tgt_path_; skew_ = clk_skew.skew_; } @@ -288,7 +288,7 @@ ClkSkews::findClkSkew(Vertex *src_vertex, skews[src_clk] = clk_skew; } else if (fuzzyGreater(probe.skew(), clk_skew->skew())) - clk_skew->copy(probe); + *clk_skew = probe; } } } diff --git a/search/ClkSkew.hh b/search/ClkSkew.hh index ef6eff8c..66c57049 100644 --- a/search/ClkSkew.hh +++ b/search/ClkSkew.hh @@ -66,4 +66,3 @@ protected: } // namespace #endif - diff --git a/search/Crpr.cc b/search/Crpr.cc index a5e8290f..d49e26fd 100644 --- a/search/Crpr.cc +++ b/search/Crpr.cc @@ -198,7 +198,7 @@ CheckCrpr::portClkPath(const ClockEdge *clk_edge, PathVertex *path = path_iter.next(); if (path->clkEdge(this) == clk_edge && path->isClock(this)) { - genclk_path.copy(path); + genclk_path = path; break; } } diff --git a/search/Latches.cc b/search/Latches.cc index 16714061..18cc1c03 100644 --- a/search/Latches.cc +++ b/search/Latches.cc @@ -241,7 +241,7 @@ Latches::latchEnableOtherPath(Path *path, PathVertex *path = path_iter.next(); if (path->isClock(this) && path->clkEdge(this) == other_clk_edge) { - other_path.copy(path); + other_path = path; break; } } @@ -269,7 +269,7 @@ Latches::latchEnablePath(Path *q_path, const ClockEdge *clk_edge = path->clkEdge(this); if (path->isClock(this) && clk_edge == en_clk_edge) { - enable_path.copy(path); + enable_path = path; break; } } diff --git a/search/PathEnd.cc b/search/PathEnd.cc index d4a1ce26..a45adc30 100644 --- a/search/PathEnd.cc +++ b/search/PathEnd.cc @@ -298,7 +298,7 @@ PathEnd::clkPath(PathVertex *path, p.prevPath(sta, prev_path, prev_arc); if (p.isClock(sta)) { - clk_path.copy(p); + clk_path = p; return; } if (prev_arc) { @@ -306,7 +306,7 @@ PathEnd::clkPath(PathVertex *path, if (prev_role == TimingRole::regClkToQ() || prev_role == TimingRole::latchEnToQ()) { p.prevPath(sta, prev_path, prev_arc); - clk_path.copy(prev_path); + clk_path = prev_path; return; } else if (prev_role == TimingRole::latchDtoQ()) { @@ -314,11 +314,11 @@ PathEnd::clkPath(PathVertex *path, Edge *prev_edge = p.prevEdge(prev_arc, sta); PathVertex enable_path; latches->latchEnablePath(&p, prev_edge, enable_path); - clk_path.copy(enable_path); + clk_path = enable_path; return; } } - p.copy(prev_path); + p = prev_path; } } @@ -1069,7 +1069,7 @@ PathEndLatchCheck::PathEndLatchCheck(Path *path, latches->latchEnableOtherPath(disable_path, disable_path->pathAnalysisPt(sta), enable_path); - clk_path_.copy(enable_path); + clk_path_ = enable_path; Search *search = sta->search(); // Same as PathEndPathDelay::findRequired. if (path_delay_ && path_delay_->ignoreClkLatency()) diff --git a/search/PathRef.cc b/search/PathRef.cc index 30b1443b..2b77308a 100644 --- a/search/PathRef.cc +++ b/search/PathRef.cc @@ -78,13 +78,13 @@ PathRef::init(const PathRef *path) void PathRef::init(const PathVertex *path) { - path_vertex_.copy(path); + path_vertex_ = path; } void PathRef::init(const PathVertex &path) { - path_vertex_.copy(path); + path_vertex_ = path; } void @@ -105,7 +105,7 @@ PathRef::init(PathEnumed *path) void PathRef::setRef(PathRef *ref) const { - ref->path_vertex_.copy(path_vertex_); + ref->path_vertex_ = path_vertex_; ref->path_enumed_ = path_enumed_; } diff --git a/search/PathVertex.cc b/search/PathVertex.cc index 44bbe0e5..a087c449 100644 --- a/search/PathVertex.cc +++ b/search/PathVertex.cc @@ -150,28 +150,13 @@ PathVertex::init(const PathVertexRep &path, } void -PathVertex::copy(const PathVertex &path) +PathVertex::operator=(const PathVertex &path) { vertex_ = path.vertex_; tag_ = path.tag_; arrival_index_ = path.arrival_index_; } -void -PathVertex::copy(const PathVertex *path) -{ - if (path) { - vertex_ = path->vertex_; - tag_ = path->tag_; - arrival_index_ = path->arrival_index_; - } - else { - vertex_ = nullptr; - tag_ = nullptr; - arrival_index_ = 0; - } -} - bool PathVertex::isNull() const { @@ -430,7 +415,7 @@ PrevPathVisitor::visitFromToPath(const Pin *, bool arrival_exists; from_path->arrivalIndex(arrival_index, arrival_exists); if (arrival_exists) { - prev_path_.copy(from_path); + prev_path_ = from_path; prev_arc_ = arc; // Stop looking for the previous path/arc. return false; @@ -476,7 +461,7 @@ PathVertex::prevPath(const StaState *sta, PrevPred2 pred(sta); PrevPathVisitor visitor(this, &pred, sta); visitor.visitFaninPaths(vertex(sta)); - prev_path.copy(visitor.prevPath()); + prev_path = visitor.prevPath(); prev_arc = visitor.prevArc(); } @@ -488,7 +473,7 @@ PathVertex::prevPath(const StaState *sta, PrevPred2 pred(sta); PrevPathVisitor visitor(this, &pred, sta); visitor.visitFaninPaths(vertex(sta)); - prev_path.copy(visitor.prevPath()); + prev_path = visitor.prevPath(); } void @@ -588,7 +573,7 @@ VertexPathIterator::findNext() PathVertex * VertexPathIterator::next() { - path_.copy(next_); + path_ = next_; findNext(); return &path_; } diff --git a/search/PathVertex.hh b/search/PathVertex.hh index 2f62ebb1..da908b5d 100644 --- a/search/PathVertex.hh +++ b/search/PathVertex.hh @@ -54,8 +54,7 @@ public: void init(Vertex *vertex, Tag *tag, int arrival_index); - void copy(const PathVertex &path); - void copy(const PathVertex *path); + void operator=(const PathVertex &path); virtual bool isNull() const; virtual void setRef(PathRef *ref) const; virtual Vertex *vertex(const StaState *) const { return vertex_; } diff --git a/search/Sta.cc b/search/Sta.cc index a75e8d0f..7a4e45d9 100644 --- a/search/Sta.cc +++ b/search/Sta.cc @@ -605,7 +605,7 @@ Sta::readLiberty(const char *filename, && network_->defaultLibertyLibrary() == nullptr) { network_->setDefaultLibertyLibrary(library); // Set units from default (first) library. - units_->copy(library->units()); + *units_ = *library->units(); } stats.report("Read liberty"); return library;