private static Reference getExternalPointerReference(Address addr, DataType newType,
			boolean stackPointers, ReferenceManager refMgr, DataType existingType) {
		Reference extRef = null;
		if ((stackPointers || newType instanceof Pointer) && existingType instanceof Pointer) {
			Reference[] refs = refMgr.getReferencesFrom(addr);
			for (Reference ref : refs) {
				if (ref.getOperandIndex() == 0 && ref.isExternalReference()) {
					extRef = ref;
					break;
				}
			}
		}
		return extRef;
	}
Create data where existing data may already exist.
@param program the program
@param addr data address (offcut data address only allowed if clearMode == ClearDataMode.CLEAR_ALL_CONFLICT_DATA)
@param newType new data-type being applied
@param length data length (used only for Dynamic newDataType which has canSpecifyLength()==true)
@param stackPointers see {@link #reconcileAppliedDataType(DataType, DataType, boolean)}
@param clearMode see CreateDataMode
@return new data created
@throws CodeUnitInsertionException if data creation failed
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/data/DataUtilities.java