private void findAndRemoveBadStructuresFromFunction(Function function, Namespace namespace)
			throws CancelledException, InvalidInputException, DuplicateNameException,
			CircularDependencyException {

		// find bad structure parameter data types
		List<Structure> badStructureDataTypes = findBadParameterDataTypes(function, namespace);

		// find bad structure return data types
		Structure badReturnType = findBadReturnType(function, namespace);
		if (badReturnType != null && !badStructureDataTypes.contains(badReturnType)) {
			badStructureDataTypes.add(badReturnType);
		}

		// if bad structures were found delete and recreate the function and all calling functions
		// in order to remove the bad data types from the function signature
		if (badStructureDataTypes.size() > 0) {
			// find all functions that call this function and do the same
			fixBadSignatures(function, badStructureDataTypes);
			// add all the new bad dts to the list of bad ones
			for (Structure structure : badStructureDataTypes) {
				monitor.checkCancelled();
				if (!badFIDStructures.contains(structure)) {
					badFIDStructures.add(structure);
				}
			}
		}
	}
Method to find empty structures that were created when incorrect FID function
signatures were applied and remove them from the given function. Incorrect structure
data types are added to a global list so that if nothing remains that references the data
type, it can be removed after all functions have been processed.
@param function the function with incorrect FID signature
@param namespace the correct namespace of the function
@throws CancelledException if cancelled
@throws InvalidInputException if error setting return type
@throws DuplicateNameException if try to create same symbol name already in namespace
@throws CircularDependencyException if parent namespace is descendant of given namespace
Ghidra/Features/Decompiler/ghidra_scripts/classrecovery/RecoveredClassHelper.java