File tree Expand file tree Collapse file tree 2 files changed +29
-6
lines changed
Expand file tree Collapse file tree 2 files changed +29
-6
lines changed Original file line number Diff line number Diff line change @@ -489,17 +489,17 @@ void dbGroup::destroy(dbGroup* group)
489489{
490490 _dbGroup* _group = (_dbGroup*) group;
491491 _dbBlock* block = (_dbBlock*) _group->getOwner ();
492- for ( auto inst : group->getInsts ()) {
493- group->removeInst (inst );
492+ while (! group->getInsts (). empty ()) {
493+ group->removeInst (*group-> getInsts (). begin () );
494494 }
495495 if (_group->region_ .isValid ()) {
496496 group->getRegion ()->removeGroup (group);
497497 }
498- for ( auto modinst : group->getModInsts ()) {
499- group->removeModInst (modinst );
498+ while (! group->getModInsts (). empty ()) {
499+ group->removeModInst (*group-> getModInsts (). begin () );
500500 }
501- for ( auto child : group->getGroups ()) {
502- group->removeGroup (child );
501+ while (! group->getGroups (). empty ()) {
502+ group->removeGroup (*group-> getGroups (). begin () );
503503 }
504504 if (_group->_parent_group .isValid ()) {
505505 group->getParentGroup ()->removeGroup (group);
Original file line number Diff line number Diff line change @@ -57,6 +57,29 @@ proc test_default { } {
5757 tearDown $db
5858}
5959
60+ proc test_destroy { } {
61+ # Setup
62+ lassign [createSimpleDB] db lib
63+ set block [create1LevelBlock $db $lib [$db getChip]]
64+ set and2 [$lib findMaster " and2" ]
65+
66+ set inst1 [odb::dbInst_create $block $and2 " inst1" ]
67+ set inst2 [odb::dbInst_create $block $and2 " inst2" ]
68+
69+ set group [odb::dbGroup_create $block " group" ]
70+ $group addInst $inst1
71+ $group addInst $inst2
72+
73+ # Test action
74+ odb::dbGroup_destroy $group
75+
76+ # Verification
77+ assertStringEq [$inst1 getGroup] " NULL"
78+ assertStringEq [$inst2 getGroup] " NULL"
79+ tearDown $db
80+ }
81+
6082test_default
83+ test_destroy
6184puts " pass"
6285exit 0
You can’t perform that action at this time.
0 commit comments