private static String determineCallingConventionName(Function destinationFunction,
			Function sourceFunction, boolean sameLanguageAndCompilerSpec) {
		String sourceConv = sourceFunction.getCallingConventionName();
		if (CompilerSpec.CALLING_CONVENTION_thiscall.equals(sourceConv)) {
			return sourceConv;
		}
		boolean applyConventionName = sameLanguageAndCompilerSpec;
		String callingConvention = sourceFunction.getCallingConventionName();
		if (applyConventionName &&
			!CompilerSpec.CALLING_CONVENTION_default.equals(callingConvention)) {
			DataTypeManager dtMgr = destinationFunction.getProgram().getDataTypeManager();
			if (GenericCallingConvention.getGenericCallingConvention(
				callingConvention) == GenericCallingConvention.unknown &&
				!dtMgr.getKnownCallingConventionNames().contains(callingConvention)) {
				applyConventionName = false;
			}
		}
		return applyConventionName ? callingConvention
				: destinationFunction.getCallingConventionName();
	}
Determines whether or not the two programs are considered to have the same processor
language and compiler specification.
@param program1 the first program
@param program2 the second program
@return true if the two programs have the same processor language and compiler spec.
Ghidra/Features/Base/src/main/java/ghidra/program/util/FunctionUtility.java