private DataType removeExplicitReturnStoragePtrParameter() {
		int index = findExplicitReturnStoragePtrParameter();
		if (index >= 0) {
			// remove explicit '__return_storage_ptr__' parameter - should always be a pointer
			ParamInfo returnStoragePtrParameter = parameters.remove(index);
			DataType dt = returnStoragePtrParameter.getDataType();
			if (dt instanceof Pointer ptr) {
				return ptr.getDataType();
			}
		}
		return null;
	}
Switch to custom storage and perform required transformations
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/function/editor/FunctionData.java