Skip to content

Commit b67f1aa

Browse files
committed
odb: avoid generating empty dtor
Signed-off-by: Matt Liberty <[email protected]>
1 parent f745f67 commit b67f1aa

File tree

7 files changed

+7
-21
lines changed

7 files changed

+7
-21
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/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;

0 commit comments

Comments
 (0)