Skip to content

Commit e390199

Browse files
committed
clang-tidy requested changes
Signed-off-by: osamahammad21 <[email protected]>
1 parent a9fa70d commit e390199

File tree

9 files changed

+29
-42
lines changed

9 files changed

+29
-42
lines changed

src/odb/include/odb/geom.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ class Cuboid
110110
public:
111111
Cuboid() = default;
112112
Cuboid(const Cuboid& other) = default;
113-
Cuboid(Point3D p1, Point3D p2);
113+
Cuboid(const Point3D& p1, const Point3D& p2);
114114
Cuboid(int x1, int y1, int z1, int x2, int y2, int z2);
115115

116116
Cuboid& operator=(const Cuboid& b) = default;
@@ -182,7 +182,7 @@ class Cuboid
182182
bool inside(const Cuboid& b) const;
183183

184184
// Return the point inside cuboid that is closest to pt.
185-
Point3D closestPtInside(Point3D pt) const;
185+
Point3D closestPtInside(const Point3D& pt) const;
186186

187187
// Compute the union of this cuboid and a point.
188188
void merge(const Point3D& p, Cuboid& result);
@@ -1209,7 +1209,7 @@ inline Cuboid::Cuboid(const int x1,
12091209
init(x1, y1, z1, x2, y2, z2);
12101210
}
12111211

1212-
inline Cuboid::Cuboid(const Point3D p1, const Point3D p2)
1212+
inline Cuboid::Cuboid(const Point3D& p1, const Point3D& p2)
12131213
: Cuboid(p1.x(), p1.y(), p1.z(), p2.x(), p2.y(), p2.z())
12141214
{
12151215
}
@@ -1267,10 +1267,10 @@ inline bool Cuboid::operator==(const Cuboid& b) const
12671267
== std::tie(b.xlo_, b.ylo_, b.zlo_, b.xhi_, b.yhi_, b.zhi_);
12681268
}
12691269

1270-
inline bool Cuboid::operator<(const Cuboid& rhs) const
1270+
inline bool Cuboid::operator<(const Cuboid& b) const
12711271
{
12721272
return std::tie(xlo_, ylo_, zlo_, xhi_, yhi_, zhi_)
1273-
< std::tie(rhs.xlo_, rhs.ylo_, rhs.zlo_, rhs.xhi_, rhs.yhi_, rhs.zhi_);
1273+
< std::tie(b.xlo_, b.ylo_, b.zlo_, b.xhi_, b.yhi_, b.zhi_);
12741274
}
12751275

12761276
inline void Cuboid::moveTo(int x, int y, int z)
@@ -1359,7 +1359,7 @@ inline bool Cuboid::inside(const Cuboid& b) const
13591359
&& (xhi_ > b.xhi_) && (yhi_ > b.yhi_) && (zhi_ > b.zhi_);
13601360
}
13611361

1362-
inline Point3D Cuboid::closestPtInside(const Point3D pt) const
1362+
inline Point3D Cuboid::closestPtInside(const Point3D& pt) const
13631363
{
13641364
return Point3D(std::min(std::max(pt.x(), xMin()), xMax()),
13651365
std::min(std::max(pt.y(), yMin()), yMax()),

src/odb/src/3dblox/checker.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "checker.h"
22

3+
#include <cstddef>
34
#include <functional>
45
#include <map>
56
#include <vector>

src/odb/src/db/dbChip.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
#include "dbChipInstItr.h"
2828
#include "dbChipNet.h"
2929
#include "dbChipNetItr.h"
30+
#include "odb/dbObject.h"
31+
#include "odb/geom.h"
3032
// User Code End Includes
3133
namespace odb {
3234
template class dbTable<_dbChip>;

src/odb/src/db/dbChipInst.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "dbChipBumpInst.h"
1717
#include "dbChipRegionInst.h"
1818
#include "odb/dbTransform.h"
19+
#include "odb/geom.h"
1920
// User Code End Includes
2021
namespace odb {
2122
template class dbTable<_dbChipInst>;

src/odb/src/db/dbChipRegion.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "dbChipInst.h"
1919
#include "dbChipRegionInst.h"
2020
#include "dbTech.h"
21+
#include "odb/geom.h"
2122
#include "utl/Logger.h"
2223
// User Code End Includes
2324
namespace odb {

src/odb/src/db/dbChipRegionInst.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "dbChipBumpInstItr.h"
1616
#include "dbChipInst.h"
1717
#include "odb/dbTransform.h"
18+
#include "odb/geom.h"
1819
// User Code End Includes
1920
namespace odb {
2021
template class dbTable<_dbChipRegionInst>;

src/odb/src/db/dbMarker.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "dbVector.h"
2424
#include "odb/db.h"
2525
// User Code Begin Includes
26+
#include "dbCore.h"
2627
#include "odb/dbBlockCallBackObj.h"
2728
// User Code End Includes
2829
namespace odb {
@@ -770,10 +771,6 @@ std::set<dbObject*> dbMarker::getSources() const
770771
objs.insert(table->getObject(id));
771772
}
772773
}
773-
} else {
774-
for (const auto& [db_type, id] : marker->sources_) {
775-
// owned by chip
776-
}
777774
}
778775
return objs;
779776
}

src/odb/src/db/dbMarkerCategory.cpp

Lines changed: 16 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "dbChip.h"
2323
#include "dbHashTable.hpp"
2424
#include "odb/dbBlockCallBackObj.h"
25+
#include "odb/dbObject.h"
2526
// User Code End Includes
2627
namespace odb {
2728
template class dbTable<_dbMarkerCategory>;
@@ -775,6 +776,13 @@ dbMarkerCategory* dbMarkerCategory::create(dbChip* chip, const char* name)
775776

776777
parent->marker_categories_map_[name] = _category->getImpl()->getId();
777778

779+
_dbBlock* block = (_dbBlock*) chip->getBlock();
780+
if (block) {
781+
for (auto cb : block->_callbacks) {
782+
cb->inDbMarkerCategoryCreate((dbMarkerCategory*) _category);
783+
}
784+
}
785+
778786
return (dbMarkerCategory*) _category;
779787
}
780788

@@ -807,43 +815,19 @@ dbMarkerCategory* dbMarkerCategory::createOrReplace(dbChip* chip,
807815

808816
dbMarkerCategory* dbMarkerCategory::create(dbBlock* block, const char* name)
809817
{
810-
dbChip* chip = block->getChip();
811-
dbMarkerCategory* category = create(chip, name);
812-
if (category == nullptr) {
813-
return nullptr;
814-
}
815-
for (auto cb : ((_dbBlock*) block)->_callbacks) {
816-
cb->inDbMarkerCategoryCreate(category);
817-
}
818-
return category;
818+
return create(block->getChip(), name);
819819
}
820820

821821
dbMarkerCategory* dbMarkerCategory::createOrGet(dbBlock* block,
822822
const char* name)
823823
{
824-
_dbChip* parent = (_dbChip*) block->getChip();
825-
826-
auto it = parent->marker_categories_map_.find(name);
827-
if (it != parent->marker_categories_map_.end()) {
828-
return (dbMarkerCategory*) parent->marker_categories_tbl_->getPtr(
829-
it->second);
830-
}
831-
832-
return create(block, name);
824+
return createOrGet(block->getChip(), name);
833825
}
834826

835827
dbMarkerCategory* dbMarkerCategory::createOrReplace(dbBlock* block,
836828
const char* name)
837829
{
838-
_dbChip* parent = (_dbChip*) block->getChip();
839-
840-
auto it = parent->marker_categories_map_.find(name);
841-
if (it != parent->marker_categories_map_.end()) {
842-
destroy(
843-
(dbMarkerCategory*) parent->marker_categories_tbl_->getPtr(it->second));
844-
}
845-
846-
return create(block, name);
830+
return createOrReplace(block->getChip(), name);
847831
}
848832

849833
dbMarkerCategory* dbMarkerCategory::create(dbMarkerCategory* category,
@@ -902,7 +886,7 @@ void dbMarkerCategory::destroy(dbMarkerCategory* category)
902886
if (_category->isTopCategory()) {
903887
_dbChip* _chip = (_dbChip*) _category->getOwner();
904888
if (_category->getBlock()) {
905-
for (auto cb : ((_dbBlock*) _category->getBlock())->_callbacks) {
889+
for (auto cb : _category->getBlock()->_callbacks) {
906890
cb->inDbMarkerCategoryDestroy(category);
907891
}
908892
}
@@ -913,8 +897,10 @@ void dbMarkerCategory::destroy(dbMarkerCategory* category)
913897
_dbMarkerCategory* parent = (_dbMarkerCategory*) _category->getOwner();
914898

915899
_dbBlock* block = parent->getBlock();
916-
for (auto cb : block->_callbacks) {
917-
cb->inDbMarkerCategoryDestroy(category);
900+
if (block) {
901+
for (auto cb : block->_callbacks) {
902+
cb->inDbMarkerCategoryDestroy(category);
903+
}
918904
}
919905

920906
parent->categories_hash_.remove(_category);

src/odb/src/db/dbUtil.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// Copyright (c) 2022-2025, The OpenROAD Authors
33
#pragma once
44

5-
#include <fmt/ranges.h>
6-
75
#include <cstddef>
86
#include <string>
97
#include <vector>

0 commit comments

Comments
 (0)