public static void checkVariableConflict(List<? extends Variable> existingVariables,
			Variable var, VariableStorage newStorage, VariableConflictHandler conflictHandler)
			throws VariableSizeException {
		if (!newStorage.isValid()) {
			return;
		}
		List<Variable> conflicts = null;
		for (Variable otherVar : existingVariables) {
			if (otherVar == null || 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 (conflicts == null) {
					conflicts = new ArrayList<>();
				}
				conflicts.add(otherVar);
			}
		}

		if (conflicts != null) {
			if (conflictHandler == null || !conflictHandler.resolveConflicts(conflicts)) {
				generateConflictException(var, newStorage, conflicts, 4);
			}
		}
	}
Check for variable storage conflict and optionally remove conflicting variables.
@param existingVariables variables to check (may contain null entries)
@param var function variable
@param newStorage variable storage
@param conflictHandler variable conflict handler
@throws VariableSizeException if another variable conflicts
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/listing/VariableUtilities.java