From 9da23bc4a348274ac3bf91568c79df039f7c8891 Mon Sep 17 00:00:00 2001 From: James Cherry Date: Wed, 15 Dec 2021 17:21:57 -0700 Subject: [PATCH] PathEndVisitor::copy const Signed-off-by: James Cherry --- include/sta/VisitPathEnds.hh | 2 +- search/PathGroup.cc | 26 +++++++++++++------------- search/Search.cc | 12 ++++++------ search/Sta.cc | 7 ++++--- search/VisitPathGroupVertices.cc | 20 +++++++++----------- 5 files changed, 33 insertions(+), 34 deletions(-) diff --git a/include/sta/VisitPathEnds.hh b/include/sta/VisitPathEnds.hh index a973599a..bd8ce042 100644 --- a/include/sta/VisitPathEnds.hh +++ b/include/sta/VisitPathEnds.hh @@ -140,7 +140,7 @@ class PathEndVisitor { public: virtual ~PathEndVisitor() {} - virtual PathEndVisitor *copy() = 0; + virtual PathEndVisitor *copy() const = 0; // Begin visiting the path ends for a vertex / path_index. virtual void vertexBegin(Vertex *) {} // Visit a path end. path_end is only valid during the call. diff --git a/search/PathGroup.cc b/search/PathGroup.cc index bd99f0db..99f8da5d 100644 --- a/search/PathGroup.cc +++ b/search/PathGroup.cc @@ -518,13 +518,13 @@ PathGroups::makePathEnds(ExceptionTo *to, class MakePathEnds1 : public PathEndVisitor { public: - explicit MakePathEnds1(PathGroups *path_groups); - virtual PathEndVisitor *copy(); + MakePathEnds1(PathGroups *path_groups); + MakePathEnds1(const MakePathEnds1&) = default; + virtual PathEndVisitor *copy() const; virtual void visit(PathEnd *path_end); virtual void vertexEnd(Vertex *vertex); private: - DISALLOW_COPY_AND_ASSIGN(MakePathEnds1); void visitPathEnd(PathEnd *path_end, PathGroup *group); @@ -535,14 +535,14 @@ private: MakePathEnds1::MakePathEnds1(PathGroups *path_groups) : path_groups_(path_groups), - cmp_(path_groups){ - + cmp_(path_groups) +{ } PathEndVisitor * -MakePathEnds1::copy() +MakePathEnds1::copy() const { - return new MakePathEnds1(path_groups_); + return new MakePathEnds1(*this); } void @@ -597,15 +597,15 @@ MakePathEnds1::vertexEnd(Vertex *) class MakePathEndsAll : public PathEndVisitor { public: - explicit MakePathEndsAll(int endpoint_count, - PathGroups *path_groups); + MakePathEndsAll(int endpoint_count, + PathGroups *path_groups); + MakePathEndsAll(const MakePathEndsAll&) = default; virtual ~MakePathEndsAll(); - virtual PathEndVisitor *copy(); + virtual PathEndVisitor *copy() const; virtual void visit(PathEnd *path_end); virtual void vertexEnd(Vertex *vertex); private: - DISALLOW_COPY_AND_ASSIGN(MakePathEndsAll); void visitPathEnd(PathEnd *path_end, PathGroup *group); @@ -629,9 +629,9 @@ MakePathEndsAll::MakePathEndsAll(int endpoint_count, PathEndVisitor * -MakePathEndsAll::copy() +MakePathEndsAll::copy() const { - return new MakePathEndsAll(endpoint_count_, path_groups_); + return new MakePathEndsAll(*this); } MakePathEndsAll::~MakePathEndsAll() diff --git a/search/Search.cc b/search/Search.cc index 21bc85e6..2db72045 100644 --- a/search/Search.cc +++ b/search/Search.cc @@ -3211,7 +3211,7 @@ public: const StaState *sta); FindEndRequiredVisitor(const StaState *sta); virtual ~FindEndRequiredVisitor(); - virtual PathEndVisitor *copy(); + virtual PathEndVisitor *copy() const; virtual void visit(PathEnd *path_end); protected: @@ -3242,7 +3242,7 @@ FindEndRequiredVisitor::~FindEndRequiredVisitor() } PathEndVisitor * -FindEndRequiredVisitor::copy() +FindEndRequiredVisitor::copy() const { return new FindEndRequiredVisitor(sta_); } @@ -3861,7 +3861,8 @@ class FindEndSlackVisitor : public PathEndVisitor public: FindEndSlackVisitor(SlackSeq &slacks, const StaState *sta); - virtual PathEndVisitor *copy(); + FindEndSlackVisitor(const FindEndSlackVisitor &) = default; + virtual PathEndVisitor *copy() const; virtual void visit(PathEnd *path_end); protected: @@ -3877,10 +3878,9 @@ FindEndSlackVisitor::FindEndSlackVisitor(SlackSeq &slacks, } PathEndVisitor * -FindEndSlackVisitor::copy() +FindEndSlackVisitor::copy() const { - - return new FindEndSlackVisitor(slacks_, sta_); + return new FindEndSlackVisitor(*this); } void diff --git a/search/Sta.cc b/search/Sta.cc index 15b7c08d..6e439af0 100644 --- a/search/Sta.cc +++ b/search/Sta.cc @@ -3040,7 +3040,8 @@ public: MinPeriodEndVisitor(const Clock *clk, bool include_port_paths, StaState *sta); - virtual PathEndVisitor *copy(); + MinPeriodEndVisitor(const MinPeriodEndVisitor &) = default; + virtual PathEndVisitor *copy() const; virtual void visit(PathEnd *path_end); float minPeriod() const { return min_period_; } @@ -3064,9 +3065,9 @@ MinPeriodEndVisitor::MinPeriodEndVisitor(const Clock *clk, } PathEndVisitor * -MinPeriodEndVisitor::copy() +MinPeriodEndVisitor::copy() const { - return new MinPeriodEndVisitor(clk_, include_port_paths_, sta_); + return new MinPeriodEndVisitor(*this); } void diff --git a/search/VisitPathGroupVertices.cc b/search/VisitPathGroupVertices.cc index 31fbc5fd..36cea68b 100644 --- a/search/VisitPathGroupVertices.cc +++ b/search/VisitPathGroupVertices.cc @@ -42,19 +42,18 @@ vertexPathSetMapInsertPath(VertexPathSetMap *matching_path_map, class VisitPathGroupEnds : public PathEndVisitor { public: - explicit VisitPathGroupEnds(PathGroup *path_group, - VertexVisitor *vertex_visitor, - VertexPathSetMap *matching_path_map, - BfsBkwdIterator *bkwd_iter, - StaState *sta); - virtual PathEndVisitor *copy(); + VisitPathGroupEnds(PathGroup *path_group, + VertexVisitor *vertex_visitor, + VertexPathSetMap *matching_path_map, + BfsBkwdIterator *bkwd_iter, + StaState *sta); + VisitPathGroupEnds(const VisitPathGroupEnds&) = default; + virtual PathEndVisitor *copy() const; virtual void visit(PathEnd *path_end); virtual void vertexBegin(Vertex *vertex); virtual void vertexEnd(Vertex *vertex); private: - DISALLOW_COPY_AND_ASSIGN(VisitPathGroupEnds); - PathGroup *path_group_; VertexVisitor *vertex_visitor_; BfsBkwdIterator *bkwd_iter_; @@ -160,10 +159,9 @@ VisitPathGroupEnds::VisitPathGroupEnds(PathGroup *path_group, } PathEndVisitor * -VisitPathGroupEnds::copy() +VisitPathGroupEnds::copy() const { - return new VisitPathGroupEnds(path_group_, vertex_visitor_, - matching_path_map_, bkwd_iter_, sta_); + return new VisitPathGroupEnds(*this); } void