Skip to content

Commit

Permalink
various: misc clang-tidy cleanups
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Liberty <mliberty@precisioninno.com>
  • Loading branch information
maliberty committed Dec 27, 2024
1 parent 4335db6 commit e834b09
Show file tree
Hide file tree
Showing 30 changed files with 54 additions and 93 deletions.
2 changes: 1 addition & 1 deletion src/cts/src/Clustering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ void Clustering::minCostFlow(const std::vector<std::pair<float, float>>& means,
float d = calcDist(means[j], &sinks_[i]);
if (d <= dist) {
d = std::pow(d, power);
if (d < std::numeric_limits<int>::max()) {
if (static_cast<int>(d) < std::numeric_limits<int>::max()) {
ListDigraph::Arc e = graph.addArc(sink_nodes[i], cluster_nodes[j]);
sink_cluster_edges.push_back(e);
costs.push_back(d);
Expand Down
2 changes: 2 additions & 0 deletions src/dpo/src/detailed_random.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ namespace dpo {
class Architecture;
class DetailedMgr;
class DetailedObjective;
class Network;
class RoutingParams;

////////////////////////////////////////////////////////////////////////////////
// Classes.
Expand Down
2 changes: 2 additions & 0 deletions src/dpo/src/detailed_segment.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@

#pragma once

#include <limits>

namespace dpo {

////////////////////////////////////////////////////////////////////////////////
Expand Down
1 change: 1 addition & 0 deletions src/dpo/src/rectangle.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
#include <algorithm>
#include <limits>

namespace dpo {
Expand Down
1 change: 0 additions & 1 deletion src/gpl/include/gpl/Replace.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ class Replace
float routabilityRcK3_ = 0.0;
float routabilityRcK4_ = 0.0;

int routabilityMaxBloatIter_ = 1;
int routabilityMaxInflationIter_ = 4;

float timingNetWeightMax_ = 1.9;
Expand Down
6 changes: 0 additions & 6 deletions src/gpl/src/mbff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2115,8 +2115,6 @@ void MBFF::SetTrayNames()

void MBFF::Run(const int mx_sz, const float alpha, const float beta)
{
auto start = std::chrono::high_resolution_clock::now();

std::srand(1);
omp_set_num_threads(num_threads_);

Expand Down Expand Up @@ -2177,10 +2175,6 @@ void MBFF::Run(const int mx_sz, const float alpha, const float beta)
odb::dbInst::destroy(inst);
}

auto end = std::chrono::high_resolution_clock::now();
auto duration
= std::chrono::duration_cast<std::chrono::milliseconds>(end - start);

log_->report("Alpha = {}, Beta = {}, #paths = {}, max size = {}",
alpha,
beta,
Expand Down
4 changes: 2 additions & 2 deletions src/gui/src/findDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ class FindObjectDialog : public QDialog, public Ui::FindObjDialog
public:
FindObjectDialog(QWidget* parent = nullptr);
public slots:
void accept();
void reject();
void accept() override;
void reject() override;
int exec() override;
};
} // namespace gui
16 changes: 7 additions & 9 deletions src/gui/src/mainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -549,17 +549,15 @@ void MainWindow::init(sta::dbSta* sta, const std::string& help_path)
new DbMarkerCategoryDescriptor(db_));
gui->registerDescriptor<odb::dbMarker*>(new DbMarkerDescriptor(db_));

gui->registerDescriptor<sta::Corner*>(new CornerDescriptor(db_, sta));
gui->registerDescriptor<sta::Corner*>(new CornerDescriptor(sta));
gui->registerDescriptor<sta::LibertyLibrary*>(
new LibertyLibraryDescriptor(db_, sta));
gui->registerDescriptor<sta::LibertyCell*>(
new LibertyCellDescriptor(db_, sta));
gui->registerDescriptor<sta::LibertyPort*>(
new LibertyPortDescriptor(db_, sta));
new LibertyLibraryDescriptor(sta));
gui->registerDescriptor<sta::LibertyCell*>(new LibertyCellDescriptor(sta));
gui->registerDescriptor<sta::LibertyPort*>(new LibertyPortDescriptor(sta));
gui->registerDescriptor<sta::LibertyPgPort*>(
new LibertyPgPortDescriptor(db_, sta));
gui->registerDescriptor<sta::Instance*>(new StaInstanceDescriptor(db_, sta));
gui->registerDescriptor<sta::Clock*>(new ClockDescriptor(db_, sta));
new LibertyPgPortDescriptor(sta));
gui->registerDescriptor<sta::Instance*>(new StaInstanceDescriptor(sta));
gui->registerDescriptor<sta::Clock*>(new ClockDescriptor(sta));

gui->registerDescriptor<BufferTree>(
new BufferTreeDescriptor(db_,
Expand Down
26 changes: 7 additions & 19 deletions src/gui/src/staDescriptors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,7 @@ static void add_limit(Descriptor::Properties& props,

//////////////////////////////////////////////////

LibertyLibraryDescriptor::LibertyLibraryDescriptor(odb::dbDatabase* db,
sta::dbSta* sta)
: db_(db), sta_(sta)
LibertyLibraryDescriptor::LibertyLibraryDescriptor(sta::dbSta* sta) : sta_(sta)
{
}

Expand Down Expand Up @@ -255,9 +253,7 @@ bool LibertyLibraryDescriptor::getAllObjects(SelectionSet& objects) const

//////////////////////////////////////////////////

LibertyCellDescriptor::LibertyCellDescriptor(odb::dbDatabase* db,
sta::dbSta* sta)
: db_(db), sta_(sta)
LibertyCellDescriptor::LibertyCellDescriptor(sta::dbSta* sta) : sta_(sta)
{
}

Expand Down Expand Up @@ -397,9 +393,7 @@ bool LibertyCellDescriptor::getAllObjects(SelectionSet& objects) const

//////////////////////////////////////////////////

LibertyPortDescriptor::LibertyPortDescriptor(odb::dbDatabase* db,
sta::dbSta* sta)
: db_(db), sta_(sta)
LibertyPortDescriptor::LibertyPortDescriptor(sta::dbSta* sta) : sta_(sta)
{
}

Expand Down Expand Up @@ -592,9 +586,7 @@ static const char* typeNameStr(sta::LibertyPgPort::PgType type)
return "<unexpected>";
}

LibertyPgPortDescriptor::LibertyPgPortDescriptor(odb::dbDatabase* db,
sta::dbSta* sta)
: db_(db), sta_(sta)
LibertyPgPortDescriptor::LibertyPgPortDescriptor(sta::dbSta* sta) : sta_(sta)
{
}

Expand Down Expand Up @@ -689,8 +681,7 @@ odb::dbMTerm* LibertyPgPortDescriptor::getMTerm(const std::any& object) const
return mterm;
}

CornerDescriptor::CornerDescriptor(odb::dbDatabase* db, sta::dbSta* sta)
: db_(db), sta_(sta)
CornerDescriptor::CornerDescriptor(sta::dbSta* sta) : sta_(sta)
{
}

Expand Down Expand Up @@ -756,9 +747,7 @@ bool CornerDescriptor::getAllObjects(SelectionSet& objects) const
return true;
}

StaInstanceDescriptor::StaInstanceDescriptor(odb::dbDatabase* db,
sta::dbSta* sta)
: db_(db), sta_(sta)
StaInstanceDescriptor::StaInstanceDescriptor(sta::dbSta* sta) : sta_(sta)
{
}

Expand Down Expand Up @@ -924,8 +913,7 @@ bool StaInstanceDescriptor::getAllObjects(SelectionSet& objects) const
return true;
}

ClockDescriptor::ClockDescriptor(odb::dbDatabase* db, sta::dbSta* sta)
: db_(db), sta_(sta)
ClockDescriptor::ClockDescriptor(sta::dbSta* sta) : sta_(sta)
{
}

Expand Down
25 changes: 9 additions & 16 deletions src/gui/src/staDescriptors.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ namespace gui {
class LibertyLibraryDescriptor : public Descriptor
{
public:
LibertyLibraryDescriptor(odb::dbDatabase* db, sta::dbSta* sta);
LibertyLibraryDescriptor(sta::dbSta* sta);

std::string getName(std::any object) const override;
std::string getTypeName() const override;
Expand All @@ -66,14 +66,13 @@ class LibertyLibraryDescriptor : public Descriptor
bool getAllObjects(SelectionSet& objects) const override;

private:
odb::dbDatabase* db_;
sta::dbSta* sta_;
};

class LibertyCellDescriptor : public Descriptor
{
public:
LibertyCellDescriptor(odb::dbDatabase* db, sta::dbSta* sta);
LibertyCellDescriptor(sta::dbSta* sta);

std::string getName(std::any object) const override;
std::string getTypeName() const override;
Expand All @@ -88,14 +87,13 @@ class LibertyCellDescriptor : public Descriptor
bool getAllObjects(SelectionSet& objects) const override;

private:
odb::dbDatabase* db_;
sta::dbSta* sta_;
};

class LibertyPortDescriptor : public Descriptor
{
public:
LibertyPortDescriptor(odb::dbDatabase* db, sta::dbSta* sta);
LibertyPortDescriptor(sta::dbSta* sta);

std::string getName(std::any object) const override;
std::string getTypeName() const override;
Expand All @@ -110,14 +108,13 @@ class LibertyPortDescriptor : public Descriptor
bool getAllObjects(SelectionSet& objects) const override;

private:
odb::dbDatabase* db_;
sta::dbSta* sta_;
};

class LibertyPgPortDescriptor : public Descriptor
{
public:
LibertyPgPortDescriptor(odb::dbDatabase* db, sta::dbSta* sta);
LibertyPgPortDescriptor(sta::dbSta* sta);

std::string getName(std::any object) const override;
std::string getTypeName() const override;
Expand All @@ -132,16 +129,15 @@ class LibertyPgPortDescriptor : public Descriptor
bool getAllObjects(SelectionSet& objects) const override;

private:
odb::dbDatabase* db_;
sta::dbSta* sta_;

odb::dbMTerm* getMTerm(const std::any& object) const;

sta::dbSta* sta_;
};

class CornerDescriptor : public Descriptor
{
public:
CornerDescriptor(odb::dbDatabase* db, sta::dbSta* sta);
CornerDescriptor(sta::dbSta* sta);

std::string getName(std::any object) const override;
std::string getTypeName() const override;
Expand All @@ -156,14 +152,13 @@ class CornerDescriptor : public Descriptor
bool getAllObjects(SelectionSet& objects) const override;

private:
odb::dbDatabase* db_;
sta::dbSta* sta_;
};

class StaInstanceDescriptor : public Descriptor
{
public:
StaInstanceDescriptor(odb::dbDatabase* db, sta::dbSta* sta);
StaInstanceDescriptor(sta::dbSta* sta);

std::string getName(std::any object) const override;
std::string getTypeName() const override;
Expand All @@ -178,7 +173,6 @@ class StaInstanceDescriptor : public Descriptor
bool getAllObjects(SelectionSet& objects) const override;

private:
odb::dbDatabase* db_;
sta::dbSta* sta_;

static constexpr int float_precision_ = 2;
Expand All @@ -187,7 +181,7 @@ class StaInstanceDescriptor : public Descriptor
class ClockDescriptor : public Descriptor
{
public:
ClockDescriptor(odb::dbDatabase* db, sta::dbSta* sta);
ClockDescriptor(sta::dbSta* sta);

std::string getName(std::any object) const override;
std::string getTypeName() const override;
Expand All @@ -202,7 +196,6 @@ class ClockDescriptor : public Descriptor
bool getAllObjects(SelectionSet& objects) const override;

private:
odb::dbDatabase* db_;
sta::dbSta* sta_;

std::set<const sta::Pin*> getClockPins(sta::Clock* clock) const;
Expand Down
10 changes: 0 additions & 10 deletions src/mpl2/src/hier_rtlmp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,10 @@ HierRTLMP::~HierRTLMP() = default;
// Constructors
HierRTLMP::HierRTLMP(sta::dbNetwork* network,
odb::dbDatabase* db,
sta::dbSta* sta,
utl::Logger* logger,
par::PartitionMgr* tritonpart)
: network_(network),
db_(db),
sta_(sta),
logger_(logger),
tritonpart_(tritonpart),
tree_(std::make_unique<PhysicalHierarchy>())
Expand Down Expand Up @@ -1058,18 +1056,10 @@ HierRTLMP::IOSpans HierRTLMP::computeIOSpans()
float HierRTLMP::computeIOBlockagesDepth(const IOSpans& io_spans)
{
float sum_length = 0.0;
int num_hor_access = 0;
int num_ver_access = 0;

for (auto& [pin_access, length] : io_spans) {
if (length.second > length.first) {
sum_length += std::abs(length.second - length.first);

if (pin_access == R || pin_access == L) {
num_hor_access++;
} else {
num_ver_access++;
}
}
}

Expand Down
2 changes: 0 additions & 2 deletions src/mpl2/src/hier_rtlmp.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ class HierRTLMP
public:
HierRTLMP(sta::dbNetwork* network,
odb::dbDatabase* db,
sta::dbSta* sta,
utl::Logger* logger,
par::PartitionMgr* tritonpart);
~HierRTLMP();
Expand Down Expand Up @@ -252,7 +251,6 @@ class HierRTLMP
sta::dbNetwork* network_ = nullptr;
odb::dbDatabase* db_ = nullptr;
odb::dbBlock* block_ = nullptr;
sta::dbSta* sta_ = nullptr;
utl::Logger* logger_ = nullptr;
par::PartitionMgr* tritonpart_ = nullptr;
std::unique_ptr<PhysicalHierarchy> tree_;
Expand Down
3 changes: 1 addition & 2 deletions src/mpl2/src/rtl_mp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ void MacroPlacer2::init(sta::dbNetwork* network,
utl::Logger* logger,
par::PartitionMgr* tritonpart)
{
hier_rtlmp_
= std::make_unique<HierRTLMP>(network, db, sta, logger, tritonpart);
hier_rtlmp_ = std::make_unique<HierRTLMP>(network, db, logger, tritonpart);
logger_ = logger;
db_ = db;
}
Expand Down
1 change: 1 addition & 0 deletions src/odb/include/odb/dbBlockSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#pragma once

#include "dbObject.h"
#include "dbSet.h"

namespace odb {

Expand Down
1 change: 1 addition & 0 deletions src/odb/include/odb/dbCCSegSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#pragma once

#include "dbObject.h"
#include "dbSet.h"

namespace odb {

Expand Down
1 change: 1 addition & 0 deletions src/odb/include/odb/dbMap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#pragma once

#include "ZException.h"
#include "dbMap.h"

namespace odb {

Expand Down
1 change: 1 addition & 0 deletions src/odb/include/odb/dbNetSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#pragma once

#include "dbObject.h"
#include "dbSet.h"

namespace odb {

Expand Down
3 changes: 0 additions & 3 deletions src/odb/src/db/dbModulePortItr.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,6 @@ class dbModulePortItr : public dbIterator

private:
dbTable<_dbModBTerm>* _modbterm_tbl;
// User Code Begin Fields
dbModulePortItr* _port_iter = nullptr;
// User Code End Fields
};

} // namespace odb
Expand Down
Loading

0 comments on commit e834b09

Please sign in to comment.