public static void checkVariableConflict(Function function, Variable var,
			VariableStorage newStorage, boolean deleteConflictingVariables)
			throws VariableSizeException {
		if (!newStorage.isValid()) {
			return;
		}
		List<Variable> conflicts = null;
		for (Variable otherVar : function.getAllVariables()) {
			if (otherVar.equals(var)) {
				// skip variable being modified
				continue;
			}
			if (var != null && otherVar.getFirstUseOffset() != var.getFirstUseOffset()) {
				// other than parameters we will have a hard time identifying
				// local variable conflicts due to differences in scope (i.e., first-use)
				continue;
			}
			if (otherVar.getVariableStorage().intersects(newStorage)) {
				if (deleteConflictingVariables) {
					function.removeVariable(otherVar);
				}
				else {
					if (conflicts == null) {
						conflicts = new ArrayList<>();
					}
					conflicts.add(otherVar);
				}
			}
		}

		if (conflicts != null) {
			generateConflictException(var, newStorage, conflicts, 4);
		}
	}
Check for variable storage conflict and optionally remove conflicting variables.
@param function function which corresponds to specified variable
@param var existing function variable or null for new variable
@param newStorage new/updated variable storage
@param deleteConflictingVariables if true function's conflicting variables may be deleted
@throws VariableSizeException if deleteConflictingVariables is false and another variable conflicts
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/listing/VariableUtilities.java