Skip to content
Merged

Tidy3 #9196

Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/ant/src/AntennaChecker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1212,8 +1212,7 @@ int AntennaChecker::Impl::checkAntennas(odb::dbNet* net,
}
omp_set_num_threads(num_threads);
#pragma omp parallel for schedule(dynamic)
for (int i = 0; i < nets_.size(); i++) {
odb::dbNet* net = nets_[i];
for (auto net : nets_) {
Violations antenna_violations;
int pin_viol_count
= checkNet(net, verbose, true, nullptr, 0, antenna_violations);
Expand Down
11 changes: 7 additions & 4 deletions src/ant/src/Polygon.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@

namespace ant {

using gtl::operators::operator+=;
using gtl::operators::operator-=;
using gtl::operators::operator&;

Polygon rectToPolygon(const odb::Rect& rect)
{
std::vector<Point> points{{gtl::construct<Point>(rect.xMin(), rect.yMin()),
Expand All @@ -34,6 +30,9 @@ Polygon rectToPolygon(const odb::Rect& rect)
std::vector<int> findNodesWithIntersection(const GraphNodes& graph_nodes,
const Polygon& pol)
{
using gtl::operators::operator+=;
using gtl::operators::operator&;

// expand object by 1
PolygonSet obj;
obj += pol;
Expand All @@ -53,6 +52,8 @@ std::vector<int> findNodesWithIntersection(const GraphNodes& graph_nodes,
void wiresToPolygonSetMap(odb::dbWire* wires,
std::map<odb::dbTechLayer*, PolygonSet>& set_by_layer)
{
using gtl::operators::operator+=;

odb::dbShape shape;
odb::dbWireShapeItr shapes_it;
std::vector<odb::dbShape> via_boxes;
Expand Down Expand Up @@ -85,6 +86,8 @@ void wiresToPolygonSetMap(odb::dbWire* wires,
void avoidPinIntersection(odb::dbNet* db_net,
std::map<odb::dbTechLayer*, PolygonSet>& set_by_layer)
{
using gtl::operators::operator-=;

// iterate all instance pin
for (odb::dbITerm* iterm : db_net->getITerms()) {
odb::dbMTerm* mterm = iterm->getMTerm();
Expand Down
13 changes: 8 additions & 5 deletions src/cts/src/HTreeBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,9 @@ void HTreeBuilder::initSinkRegion()
logger_->info(CTS, 26, " Height: {:.4f}.", sinkRegion_.getHeight());
}

void plotBlockage(std::ofstream& file, odb::dbDatabase* db_, int scalingFactor)
static void plotBlockage(std::ofstream& file,
odb::dbDatabase* db_,
int scalingFactor)
{
unsigned i = 0;
for (odb::dbBlockage* blockage : db_->getChip()->getBlock()->getBlockages()) {
Expand Down Expand Up @@ -351,7 +353,8 @@ double HTreeBuilder::weightedDistance(const Point<double>& newLoc,
return dist;
}

void plotSinks(std::ofstream& file, const std::vector<Point<double>>& sinks)
static void plotSinks(std::ofstream& file,
const std::vector<Point<double>>& sinks)
{
unsigned cnt = 0;
for (const Point<double>& pt : sinks) {
Expand Down Expand Up @@ -407,9 +410,9 @@ void HTreeBuilder::scalePosition(Point<double>& loc,
loc.setY(y);
}

void setSiblingPosition(const Point<double>& a,
Point<double>& b,
const Point<double>& parLoc)
static void setSiblingPosition(const Point<double>& a,
Point<double>& b,
const Point<double>& parLoc)
{
double px = parLoc.getX();
double py = parLoc.getY();
Expand Down
11 changes: 2 additions & 9 deletions src/cts/src/TritonCTS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -685,13 +685,6 @@ void TritonCTS::setBufferList(const char* buffers)
options_->setBufferList(bufferList);
}

std::string toLowerCase(std::string str)
{
std::ranges::transform(
str, str.begin(), [](unsigned char c) { return std::tolower(c); });
return str;
}

std::string TritonCTS::getRootBufferToString()
{
std::ostringstream buffer_names;
Expand Down Expand Up @@ -2235,7 +2228,7 @@ double TritonCTS::computeInsertionDelay(const std::string& name,
return insDelayPerMicron;
}

float getInputCap(const sta::LibertyCell* cell)
static float getInputCap(const sta::LibertyCell* cell)
{
sta::LibertyPort *in, *out;
cell->bufferPorts(in, out);
Expand All @@ -2245,7 +2238,7 @@ float getInputCap(const sta::LibertyCell* cell)
return 0.0;
}

sta::LibertyCell* findBestDummyCell(
static sta::LibertyCell* findBestDummyCell(
const std::vector<sta::LibertyCell*>& dummyCandidates,
float deltaCap)
{
Expand Down
8 changes: 4 additions & 4 deletions src/dbSta/src/SpefWriter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ SpefWriter::SpefWriter(Logger* logger,
writePorts();
}

std::string escapeSpecial(const std::string& name)
static std::string escapeSpecial(const std::string& name)
{
std::string result = name;
size_t pos = 0;
Expand All @@ -49,7 +49,7 @@ std::string escapeSpecial(const std::string& name)
return result;
}

std::string escapeSpecial(const char* name)
static std::string escapeSpecial(const char* name)
{
if (!name) {
return "";
Expand All @@ -60,7 +60,7 @@ std::string escapeSpecial(const char* name)
// Quick fix for wrong pin delimiter.
// TODO: save the parasitics data to odb and use the existing write_spef
// mechanism to produce the spef files from estimate_parasitics.
std::string fixPinDelimiter(const std::string& name)
static std::string fixPinDelimiter(const std::string& name)
{
const char delimiter = '/';
std::string result = name;
Expand Down Expand Up @@ -104,7 +104,7 @@ void SpefWriter::writeHeader()
}
}

char getIoDirectionText(const odb::dbIoType& io_type)
static char getIoDirectionText(const odb::dbIoType& io_type)
{
if (io_type == odb::dbIoType::INPUT) {
return 'I';
Expand Down
2 changes: 1 addition & 1 deletion src/dbSta/src/dbSta.cc
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ void dbSta::countPhysicalOnlyInstancesByType(InstTypeMap& inst_type_stats,
}
}

std::string toLowerCase(std::string str)
static std::string toLowerCase(std::string str)
{
std::ranges::transform(
str, str.begin(), [](unsigned char c) { return std::tolower(c); });
Expand Down
3 changes: 2 additions & 1 deletion src/dbSta/test/cpp/TestHconn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ static const std::string prefix("_main/src/dbSta/test/");
Shows the dbNet and dbModNet view of the database.
*/

void DbStrDebugHierarchy(dbBlock* block, std::stringstream& str_db)
// NOLINTNEXTLINE(clang-diagnostic-unused-function)
static void DbStrDebugHierarchy(dbBlock* block, std::stringstream& str_db)
{
str_db << fmt::format("Debug: Data base tables for block at {}:\n",
block->getName());
Expand Down
2 changes: 1 addition & 1 deletion src/dpl/src/CheckPlacement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ using std::vector;

using utl::DPL;

using utl::format_as;
using utl::format_as; // NOLINT(misc-unused-using-decls)

void Opendp::checkPlacement(const bool verbose,
const std::string& report_file_name)
Expand Down
2 changes: 1 addition & 1 deletion src/dpl/src/FillerPlacement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ using utl::DPL;
using odb::dbMaster;
using odb::dbPlacementStatus;

using utl::format_as;
using utl::format_as; // NOLINT(misc-unused-using-decls)

static odb::dbTechLayer* getImplant(dbMaster* master)
{
Expand Down
1 change: 0 additions & 1 deletion src/dpl/src/OptMirror.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ namespace dpl {

using utl::DPL;

using std::sort;
using std::unordered_set;

using odb::dbITerm;
Expand Down
3 changes: 1 addition & 2 deletions src/dpl/src/Place.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,12 @@ namespace dpl {
using std::max;
using std::min;
using std::numeric_limits;
using std::sort;
using std::string;
using std::vector;

using utl::DPL;

using utl::format_as;
using utl::format_as; // NOLINT(misc-unused-using-decls)

std::string Opendp::printBgBox(
const boost::geometry::model::box<bgPoint>& queryBox)
Expand Down
2 changes: 1 addition & 1 deletion src/dpl/src/infrastructure/Grid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ using utl::DPL;
using odb::dbBox;
using odb::dbRow;

using utl::format_as;
using utl::format_as; // NOLINT(misc-unused-using-decls)

PixelPt::PixelPt(Pixel* pixel1, GridX grid_x, GridY grid_y)
: pixel(pixel1), x(grid_x), y(grid_y)
Expand Down
4 changes: 2 additions & 2 deletions src/dpl/src/optimization/detailed_mis.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,8 @@ void DetailedMis::populateGrid()
// Inserts movable cells into the grid.

for (auto& row : grid_) {
for (size_t j = 0; j < row.size(); j++) {
row[j]->clear();
for (auto& bucket : row) {
bucket->clear();
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/drt/src/gc/FlexGC_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2227,7 +2227,7 @@ bool FlexGCWorker::Impl::checkMetalShape_lef58Area_rectWidth(
gtl::get_max_rectangles(rects, polySet);
if (rects.size() == 1) {
int min_width = db_rule->getRectWidth();
auto rect = rects.back();
const auto& rect = rects.back();
auto xLen = gtl::delta(rect, gtl::HORIZONTAL);
auto yLen = gtl::delta(rect, gtl::VERTICAL);
bool apply_rect_width_area = false;
Expand Down
6 changes: 3 additions & 3 deletions src/dst/include/dst/BalancerJobDescription.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ class BalancerJobDescription : public JobDescription
{
public:
void setWorkerIP(const std::string& ip) { worker_ip_ = ip; }
void setWorkerPort(unsigned short port) { worker_port_ = port; }
void setWorkerPort(uint16_t port) { worker_port_ = port; }
std::string getWorkerIP() const { return worker_ip_; }
unsigned short getWorkerPort() const { return worker_port_; }
uint16_t getWorkerPort() const { return worker_port_; }

private:
std::string worker_ip_;
unsigned short worker_port_{0};
uint16_t worker_port_{0};

template <class Archive>
void serialize(Archive& ar, const unsigned int version)
Expand Down
6 changes: 3 additions & 3 deletions src/dst/include/dst/BroadcastJobDescription.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ namespace dst {
class BroadcastJobDescription : public JobDescription
{
public:
void setWorkersCount(unsigned short count) { workers_count_ = count; }
unsigned short getWorkersCount() const { return workers_count_; }
void setWorkersCount(uint16_t count) { workers_count_ = count; }
uint16_t getWorkersCount() const { return workers_count_; }

private:
unsigned short workers_count_{0};
uint16_t workers_count_{0};

template <class Archive>
void serialize(Archive& ar, const unsigned int version)
Expand Down
4 changes: 2 additions & 2 deletions src/dst/include/dst/Distributed.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ class Distributed
struct EndPoint
{
std::string ip;
unsigned short port;
EndPoint(const std::string& ip_in, unsigned short port_in)
uint16_t port;
EndPoint(const std::string& ip_in, uint16_t port_in)
: ip(ip_in), port(port_in)
{
}
Expand Down
4 changes: 2 additions & 2 deletions src/dst/src/BalancerConnection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ void BalancerConnection::handle_read(boost::system::error_code const& err,
asio::thread_pool pool(owner_->workers_.size());
auto workers_copy = owner_->workers_;
std::mutex broadcast_failure_mutex;
std::vector<std::pair<ip::address, unsigned short>> failed_workers;
std::vector<std::pair<ip::address, uint16_t>> failed_workers;
while (!workers_copy.empty()) {
auto worker = workers_copy.top();
workers_copy.pop();
Expand Down Expand Up @@ -182,7 +182,7 @@ void BalancerConnection::handle_read(boost::system::error_code const& err,
pool.join();
JobMessage result(JobMessage::kSuccess);
std::string msg_str;
unsigned short success_broadcast
uint16_t success_broadcast
= owner_->workers_.size() - failed_workers.size();
if (!failed_workers.empty()) {
for (const auto& worker : failed_workers) {
Expand Down
12 changes: 5 additions & 7 deletions src/dst/src/LoadBalancer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -116,22 +116,22 @@ void LoadBalancer::updateWorker(const ip::address& ip, unsigned short port)
}
workers_.swap(new_queue);
}
void LoadBalancer::getNextWorker(ip::address& ip, unsigned short& port)
void LoadBalancer::getNextWorker(ip::address& ip, uint16_t& port)
{
std::lock_guard<std::mutex> lock(workers_mutex_);
if (!workers_.empty()) {
Worker w = workers_.top();
workers_.pop();
ip = w.ip;
port = w.port;
if (w.priority != std::numeric_limits<unsigned short>::max()) {
if (w.priority != std::numeric_limits<uint16_t>::max()) {
w.priority++;
}
workers_.push(w);
}
}

void LoadBalancer::punishWorker(const ip::address& ip, unsigned short port)
void LoadBalancer::punishWorker(const ip::address& ip, uint16_t port)
{
std::lock_guard<std::mutex> lock(workers_mutex_);
std::priority_queue<Worker, std::vector<Worker>, CompareWorker> new_queue;
Expand All @@ -146,9 +146,7 @@ void LoadBalancer::punishWorker(const ip::address& ip, unsigned short port)
workers_.swap(new_queue);
}

void LoadBalancer::removeWorker(const ip::address& ip,
unsigned short port,
bool lock)
void LoadBalancer::removeWorker(const ip::address& ip, uint16_t port, bool lock)
{
if (lock) {
workers_mutex_.lock();
Expand All @@ -168,7 +166,7 @@ void LoadBalancer::removeWorker(const ip::address& ip,
}
}

void LoadBalancer::lookUpWorkers(const char* domain, unsigned short port)
void LoadBalancer::lookUpWorkers(const char* domain, uint16_t port)
{
asio::io_context ios;
std::vector<Worker> workers_set;
Expand Down
22 changes: 10 additions & 12 deletions src/dst/src/LoadBalancer.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,21 @@ class LoadBalancer
utl::Logger* logger,
const char* ip,
const char* workers_domain,
unsigned short port = 1234);
uint16_t port = 1234);
~LoadBalancer();
bool addWorker(const std::string& ip, unsigned short port);
void updateWorker(const ip::address& ip, unsigned short port);
void getNextWorker(ip::address& ip, unsigned short& port);
void removeWorker(const ip::address& ip,
unsigned short port,
bool lock = true);
void punishWorker(const ip::address& ip, unsigned short port);
bool addWorker(const std::string& ip, uint16_t port);
void updateWorker(const ip::address& ip, uint16_t port);
void getNextWorker(ip::address& ip, uint16_t& port);
void removeWorker(const ip::address& ip, uint16_t port, bool lock = true);
void punishWorker(const ip::address& ip, uint16_t port);

private:
struct Worker
{
ip::address ip;
unsigned short port;
unsigned short priority;
Worker(const ip::address& ip, unsigned short port, unsigned short priority)
uint16_t port;
uint16_t priority;
Worker(const ip::address& ip, uint16_t port, uint16_t priority)
: ip(ip), port(port), priority(priority)
{
}
Expand Down Expand Up @@ -86,7 +84,7 @@ class LoadBalancer
void start_accept();
void handle_accept(const BalancerConnection::Pointer& connection,
const boost::system::error_code& err);
void lookUpWorkers(const char* domain, unsigned short port);
void lookUpWorkers(const char* domain, uint16_t port);
friend class dst::BalancerConnection;
};
} // namespace dst
Loading
Loading