public Function createEmptyFunction(String name, String namespace, String callingConventionName,
			boolean customStorage, String address, int bodySize, DataType returnType,
			Parameter... params) throws Exception {

		return tx(() -> {
			Address entryPoint = addr(address);
			Address endAddress = entryPoint.add(bodySize - 1);
			AddressSet body = new AddressSet(entryPoint, endAddress);
			FunctionManager functionManager = program.getFunctionManager();

			Function function = null;
			if (namespace == null) {
				function =
					functionManager.createFunction(name, entryPoint, body, SourceType.USER_DEFINED);
			}
			else {
				Namespace ns = getNamespace(namespace);
				function = functionManager.createFunction(name, ns, entryPoint, body,
					SourceType.USER_DEFINED);
			}

			Parameter[] myParams = params;
			if (myParams == null) {
				myParams = new Parameter[0];
			}

			Variable returnVar = returnType != null ? new ReturnParameterImpl(returnType, program)
					: function.getReturn();
			function.updateFunction(callingConventionName, returnVar,
				customStorage ? FunctionUpdateType.CUSTOM_STORAGE
						: FunctionUpdateType.DYNAMIC_STORAGE_FORMAL_PARAMS,
				false, SourceType.USER_DEFINED, myParams);

			return function;
		});
	}
Creates a function by examining the instructions to find the body.

@param addressString the address
@return the function
Ghidra/Features/Base/src/main/java/ghidra/program/database/ProgramBuilder.java