private boolean targetOnlyCallsNoReturn(Program cp, Address target, AddressSet noReturnSet)
			throws CancelledException {

		SimpleBlockModel model = new SimpleBlockModel(cp);

		// follow the flow of the instructions
		// if hit return, then no good
		// if hit call, check noReturn, if is stop following
		// if hit place that is called, then stop, and return no-good

		Stack<Address> todo = new Stack<>();
		todo.push(target);
		AddressSet visited = new AddressSet();
		boolean hitNoReturn = false;

		while (!todo.isEmpty()) {
			Address blockAddr = todo.pop();
			CodeBlock block = model.getCodeBlockAt(blockAddr, monitor);

			if (block == null) {
				return false;
			}
			if (visited.contains(blockAddr)) {
				continue;
			}
			visited.add(blockAddr);

			FlowType flowType = block.getFlowType();
			// terminal block and not a Call_Return that must be checked
			if (flowType.isTerminal() && !flowType.isCall()) {
				return false;
			}

			// if target has a call to it, then can't tell, but suspect...
			// add all destinations to todo
			CodeBlockReferenceIterator destinations = block.getDestinations(monitor);

			// no destinations
			if (!destinations.hasNext()) {
				return false;
			}
			while (destinations.hasNext()) {
				CodeBlockReference destRef = destinations.next();
				Address destAddr = destRef.getReference();

				FlowType destFlowType = destRef.getFlowType();

				// check call or jump to non-returning destination			
				if (destFlowType.isCall() || destFlowType.isJump()) {
					// check target
					// if non-Return, set-hit no return, and continue;
					if (noReturnSet.contains(destAddr)) {
						hitNoReturn = true;
						continue;
					}
					Function func = cp.getFunctionManager().getFunctionAt(destAddr);
					if (func != null && func.hasNoReturn()) {
						hitNoReturn = true;
						continue;
					}
					// hit terminal with returning call (could be a JUMP as well)
					if (flowType.isTerminal() && (destFlowType.isCall() || func != null)) {
						return false;
					}
				}
				if (destFlowType.isCall()) {
					continue;
				}
				// indirect flows are not part of the function
				if (destFlowType.isIndirect()) {
					continue;
				}
				todo.push(destAddr);
			}
		}

		return hitNoReturn;
	}
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