public final Function createFunction(Address entryPoint, String name) {
		CreateFunctionCmd cmd = new CreateFunctionCmd(name, entryPoint, null,
			name != null ? SourceType.USER_DEFINED : SourceType.DEFAULT);
		if (cmd.applyTo(currentProgram, monitor)) {
			return currentProgram.getListing().getFunctionAt(entryPoint);
		}
		return null;
	}
Creates a function at entry point with the specified name
@param entryPoint the entry point of the function
@param name the name of the function or null for a default function
@return the new function or null if the function was not created
Ghidra/Features/Base/src/main/java/ghidra/program/flatapi/FlatProgramAPI.java