Corrected rare case where a cell that is flattened is the first
instance in a cell, and is empty, and causes the cell contents to be nulled out.
This commit is contained in:
parent
ace1c28507
commit
ccdd47bc0b
|
|
@ -486,24 +486,30 @@ int flattenInstancesOf(char *name, int fnum, char *instance)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* splice instance out of parent */
|
/* splice instance out of parent */
|
||||||
if (ParentParams == ThisCell->cell) {
|
if ((ParentParams == ThisCell->cell) && (ChildObjList == NULL)) {
|
||||||
/* ParentParams are the very first thing in the list */
|
ThisCell->cell = ob2; /* Child cell was empty */
|
||||||
ThisCell->cell = ChildObjList;
|
tmp = ob2;
|
||||||
for (ob2 = ChildObjList; ob2 && ob2->next != NULL; ob2 = ob2->next) ;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* find ParentParams in ThisCell list */
|
if (ParentParams == ThisCell->cell) {
|
||||||
for (ob2 = ThisCell->cell; ob2 && ob2->next != ParentParams; ob2=ob2->next);
|
/* ParentParams are the very first thing in the list */
|
||||||
if (ob2)
|
ThisCell->cell = ChildObjList;
|
||||||
for (ob2->next = ChildObjList; ob2->next != NULL; ob2 = ob2->next) ;
|
for (ob2 = ChildObjList; ob2 && ob2->next != NULL; ob2 = ob2->next) ;
|
||||||
}
|
}
|
||||||
/* now, ob2 is last element in child list, so skip and reclaim parent */
|
else {
|
||||||
|
/* find ParentParams in ThisCell list */
|
||||||
|
for (ob2 = ThisCell->cell; ob2 && ob2->next != ParentParams; ob2=ob2->next);
|
||||||
|
if (ob2)
|
||||||
|
for (ob2->next = ChildObjList; ob2->next != NULL; ob2 = ob2->next) ;
|
||||||
|
}
|
||||||
|
/* now, ob2 is last element in child list, so skip and reclaim parent */
|
||||||
|
|
||||||
tmp = ParentParams;
|
tmp = ParentParams;
|
||||||
do {
|
do {
|
||||||
tmp = tmp->next;
|
tmp = tmp->next;
|
||||||
} while ((tmp != NULL) && ((tmp->type > FIRSTPIN) || (tmp->type == PROPERTY)));
|
} while ((tmp != NULL) && ((tmp->type > FIRSTPIN) || (tmp->type == PROPERTY)));
|
||||||
if (ob2) ob2->next = tmp;
|
if (ob2) ob2->next = tmp;
|
||||||
|
}
|
||||||
while (ParentParams != tmp) {
|
while (ParentParams != tmp) {
|
||||||
ob2 = ParentParams->next;
|
ob2 = ParentParams->next;
|
||||||
FreeObjectAndHash(ParentParams, ThisCell);
|
FreeObjectAndHash(ParentParams, ThisCell);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue