readLibraryAttributes only call when non-empty library

Signed-off-by: James Cherry <cherry@parallaxsw.com>
This commit is contained in:
James Cherry 2026-03-09 18:12:56 -07:00
parent 129d007f76
commit 0850e97b88
3 changed files with 24 additions and 2 deletions

View File

@ -324,6 +324,24 @@ LibertyGroup::clear()
deleteContents(variables_);
}
bool
LibertyGroup::empty() const
{
return subgroups_.empty()
&& simple_attr_map_.empty()
&& complex_attr_map_.empty()
&& define_map_.empty();
}
bool
LibertyGroup::oneGroupOnly() const
{
return subgroups_.size() == 1
&& simple_attr_map_.empty()
&& complex_attr_map_.empty()
&& define_map_.empty();
}
void
LibertyGroup::addSubgroup(LibertyGroup *subgroup)
{

View File

@ -127,6 +127,8 @@ public:
int line);
~LibertyGroup();
void clear();
bool empty() const;
bool oneGroupOnly() const;
const std::string &type() const { return type_; }
const LibertyAttrValueSeq &params() const { return params_; }
// First param as a string.

View File

@ -151,7 +151,8 @@ LibertyReader::endLibrary(const LibertyGroup *library_group,
LibertyGroup *)
{
// If a library has no cells endCell is not called.
readLibraryAttributes(library_group);
if (!library_group->empty())
readLibraryAttributes(library_group);
checkThresholds(library_group);
delete library_group;
}
@ -166,7 +167,8 @@ LibertyReader::endCell(const LibertyGroup *cell_group,
// Normally they are all defined by the first cell, but there
// are libraries that define table templates and bus tyupes
// between cells.
readLibraryAttributes(library_group);
if (!library_group->oneGroupOnly())
readLibraryAttributes(library_group);
const char *name = cell_group->firstName();
if (name) {