@Override
	public boolean added(Program program, AddressSetView set, TaskMonitor monitor, MessageLog log)
			throws CancelledException {

		ReferenceManager mgr = program.getReferenceManager();
		Listing listing = program.getListing();

		AddressSet sharedReturnSet = new AddressSet();

		int count = 0;
		long initial_count = set.getNumAddresses();
		monitor.initialize(initial_count);
		AddressSet leftSet = new AddressSet(set);

		//
		// gather up all the locations that are referenced as calls
		//
		AddressIterator iter = mgr.getReferenceSourceIterator(set, true);
		while (iter.hasNext()) {
			monitor.checkCancelled();

			Address addr = iter.next();

			count++;
			if (count > NOTIFICATION_INTERVAL) {
				leftSet.deleteRange(leftSet.getMinAddress(), addr);
				monitor.setProgress(initial_count - leftSet.getNumAddresses());
				monitor.setMessage("Find Shared Return : " + addr);
				count = 0;
			}

			Instruction instr = listing.getInstructionAt(addr);
			if (instr == null) {
				continue;
			}
			FlowType flowType = instr.getFlowType();
			if (!flowType.isJump()) {
				continue;
			}
			Reference[] refs = mgr.getFlowReferencesFrom(addr);

			for (int refIndex = 0; refIndex < refs.length; refIndex++) {
				Reference ref = refs[refIndex];
				RefType refType = ref.getReferenceType();

				if (refType.isJump()) {
					// check if the refto is a function
					// throw it on the jump to function list
					Address entryAddr = ref.getToAddress();

					Function funcAt = program.getFunctionManager().getFunctionAt(entryAddr);
					if (funcAt == null) {
						continue;
					}

					sharedReturnSet.addRange(entryAddr, entryAddr);
				}
			}
		}

		return super.added(program, sharedReturnSet, monitor, log);
	}
Called when code has been added.
Looks instructions for jumps to functions that are shared returns.
@throws CancelledException
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/function/SharedReturnJumpAnalyzer.java