private boolean detectNoReturn(Program cp, AddressSet noReturnSet, AddressSetView checkSet)
			throws CancelledException {

		AddressSet checkedSet = new AddressSet();

		boolean hadSuspiciousFunctions = false;

		AddressIterator refIter =
			cp.getReferenceManager().getReferenceSourceIterator(checkSet, true);
		for (Address address : refIter) {
			monitor.checkCancelled();

			// instruction may have already been checked from a non-returning call
			if (checkedSet.contains(address)) {
				continue;
			}
			checkedSet.add(address);

			// get the instruction there
			Instruction inst = cp.getListing().getInstructionAt(address);
			if (inst == null) {
				continue;
			}

			// if not a call, or has no fallthru
			if (!inst.getFlowType().isCall() || !inst.getFlowType().hasFallthrough()) {
				continue;
			}

			// check for indications the called instruction doesn't return
			if (!checkNonReturningIndicators(inst, noReturnSet)) {
				continue;
			}

			// detected a calling issue, check other instructions calling the same place
			Address[] flows = inst.getFlows();
			for (Address target : flows) {

				int count = 1;
				ReferenceIterator refsTo = cp.getReferenceManager().getReferencesTo(target);
				for (Reference reference : refsTo) {
					if (!reference.getReferenceType().isCall()) {
						continue;
					}

					Address fromAddress = reference.getFromAddress();
					if (checkedSet.contains(fromAddress)) {
						continue;
					}
					checkedSet.add(fromAddress);

					// call is already on the list
					// done here so all other calls don't get re-checked
					if (noReturnSet.contains(target)) {
						continue;
					}
					Instruction oinst = cp.getListing().getInstructionAt(fromAddress);
					if (oinst == null || !checkNonReturningIndicators(oinst, noReturnSet)) {
						continue;
					}

					// add one to count, if passes threshold, tag as non-returning
					count++;
					if (count >= evidenceThresholdFunctions) {
						noReturnSet.add(target);
						break;
					}
				}

				// was suspicious, but evidence didn't pass threshold
				if (count < evidenceThresholdFunctions) {
					// if function only calls non-returning functions
					if (targetOnlyCallsNoReturn(cp, target, noReturnSet)) {
						NoReturnLocations location =
							new NoReturnLocations(target, null, "Calls only non-returing function");
						reasonList.add(location);
						noReturnSet.add(target);
						continue;
					}
					hadSuspiciousFunctions = true;
				}
			}
		}
		return hadSuspiciousFunctions;
	}
Find locations that need repairing.  The locations returned are only the
start of a flow that occurs after a call to a non-returning function.

@param cp current program
@param entry non-returning function entry point
@return an address set of the locations that may need repairing

@throws CancelledException if monitor is canceled
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/FindNoReturnFunctionsAnalyzer.java