public static DataType getBaseDataType(DataType dataType, boolean includeTypedefs) {
		if (dataType instanceof Array) {
			return getBaseDataType(((Array) dataType).getDataType(), includeTypedefs);
		}
		else if (dataType instanceof Pointer) {
			DataType baseDataType = ((Pointer) dataType).getDataType();
			if (baseDataType != null) {
				return getBaseDataType(baseDataType, includeTypedefs);
			}
		}
		else if (includeTypedefs && dataType instanceof TypeDef) {
			DataType baseDataType = ((TypeDef) dataType).getBaseDataType();
			return getBaseDataType(baseDataType, includeTypedefs);
		}
		return dataType;
	}
A recursive function to get the base highest level data type for the given data type.  For
example, if the give data type is an {@link Array}, then this
method will be called again on its data type.
<p>
It is not always appropriate to find the base data type. This method contains the
logic for determining when it is appropriate the seek out the
base data type, as in the case of an Array object.

@param dataType The data type for which to find the highest level data type
@param includeTypedefs if true, then Typedef data types will be replaced with their base
       data type
@return The highest level data type for the given data type
@see #getBaseDataType(DataType)
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/navigation/locationreferences/ReferenceUtils.java