Skip to content

Commit 8c623a8

Browse files
authored
Merge pull request #9100 from The-OpenROAD-Project-staging/odb-tidy
Odb resolve clang-tidy from #9096
2 parents b10f4b6 + 3624e6f commit 8c623a8

27 files changed

+43
-26
lines changed

src/odb/src/codeGenerator/gen.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,12 +201,16 @@ def add_field_attributes(field, klass, flags_struct, schema):
201201
field["setterArgumentType"] = field["getterReturnType"] = field["type"]
202202

203203
# For fields that we need to free/destroy in the destructor
204-
if (
204+
needs_free = (
205205
field["name"] == "name_"
206+
and field["type"] == "char *"
206207
and "no-destruct" not in field["flags"]
207-
or "table" in field
208-
):
208+
)
209+
210+
if needs_free or "table" in field:
209211
klass["needs_non_default_destructor"] = True
212+
if needs_free:
213+
klass["cpp_sys_includes"].extend(["cstdlib"])
210214
return flag_num_bits
211215

212216

src/odb/src/codeGenerator/schema/tech/dbTechLayerCornerSpacingRule.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,5 +100,11 @@
100100
],
101101
"cpp_includes": [
102102
"dbTechLayer.h"
103+
],
104+
"cpp_sys_includes": [
105+
"utility"
106+
],
107+
"h_sys_includes": [
108+
"utility"
103109
]
104110
}

src/odb/src/db/dbChip.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// Generator Code Begin Cpp
55
#include "dbChip.h"
66

7+
#include <cstdlib>
78
#include <string>
89
#include <unordered_map>
910

src/odb/src/db/dbChipConn.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,6 @@ void _dbChipConn::collectMemInfo(MemInfo& info)
8484
info.size += sizeof(*this);
8585
}
8686

87-
_dbChipConn::~_dbChipConn()
88-
{
89-
}
90-
9187
////////////////////////////////////////////////////////////////////
9288
//
9389
// dbChipConn - Methods

src/odb/src/db/dbChipConn.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ class _dbChipConn : public _dbObject
2424
public:
2525
_dbChipConn(_dbDatabase*);
2626

27-
~_dbChipConn();
28-
2927
bool operator==(const _dbChipConn& rhs) const;
3028
bool operator!=(const _dbChipConn& rhs) const { return !operator==(rhs); }
3129
bool operator<(const _dbChipConn& rhs) const;

src/odb/src/db/dbChipInst.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,6 @@ void _dbChipInst::collectMemInfo(MemInfo& info)
9393
info.size += sizeof(*this);
9494
}
9595

96-
_dbChipInst::~_dbChipInst()
97-
{
98-
}
99-
10096
////////////////////////////////////////////////////////////////////
10197
//
10298
// dbChipInst - Methods

src/odb/src/db/dbChipInst.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ class _dbChipInst : public _dbObject
2828
public:
2929
_dbChipInst(_dbDatabase*);
3030

31-
~_dbChipInst();
32-
3331
bool operator==(const _dbChipInst& rhs) const;
3432
bool operator!=(const _dbChipInst& rhs) const { return !operator==(rhs); }
3533
bool operator<(const _dbChipInst& rhs) const;

src/odb/src/db/dbChipNet.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,6 @@ void _dbChipNet::collectMemInfo(MemInfo& info)
6767
info.size += sizeof(*this);
6868
}
6969

70-
_dbChipNet::~_dbChipNet()
71-
{
72-
}
73-
7470
////////////////////////////////////////////////////////////////////
7571
//
7672
// dbChipNet - Methods

src/odb/src/db/dbChipNet.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ class _dbChipNet : public _dbObject
2727
public:
2828
_dbChipNet(_dbDatabase*);
2929

30-
~_dbChipNet();
31-
3230
bool operator==(const _dbChipNet& rhs) const;
3331
bool operator!=(const _dbChipNet& rhs) const { return !operator==(rhs); }
3432
bool operator<(const _dbChipNet& rhs) const;

src/odb/src/db/dbCore.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ inline uint _dbObject::getOID() const
277277
{
278278
dbObjectPage* page = getObjectPage();
279279
uint offset = (oid_ & DB_OFFSET_MASK);
280-
return page->page_addr_ | offset / page->table_->obj_size_;
280+
return page->page_addr_ | (offset / page->table_->obj_size_);
281281
}
282282

283283
inline dbObjectTable* _dbObject::getTable() const

0 commit comments

Comments
 (0)