public DataType clean(DataType dt) {

		if (txId == -1) {
			throw new IllegalStateException("DataTypeCleaner has been closed");
		}

		DataType cleanDt = cleanerDtm.resolve(dt,
			DataTypeConflictHandler.REPLACE_EMPTY_STRUCTS_OR_RENAME_AND_ADD_HANDLER);

		Iterator<Composite> allComposites = cleanerDtm.getAllComposites();
		while (allComposites.hasNext()) {
			Composite c = allComposites.next();
			if (c.isNotYetDefined()) {
				continue;
			}
			if (retainExistingComposites && targetContainsComposite(c)) {
				continue;
			}
			Composite replacement = null;
			if (c instanceof Structure s) {
				replacement =
					new StructureDataType(c.getCategoryPath(), c.getName(), 0, cleanerDtm);
			}
			else if (c instanceof Union u) {
				replacement = new UnionDataType(c.getCategoryPath(), c.getName(), cleanerDtm);
			}
			if (replacement != null) {
				replacement.setDescription(c.getDescription());
				c.replaceWith(replacement);
			}
		}
		return cleanDt;
	}
Clean the specified datatype
@param dt datatype
@return clean datatype
Ghidra/Features/Base/src/main/java/ghidra/program/util/DataTypeCleaner.java