There are two different questions: "do all paths lead to returning a value?" and "will the function return a value?"
Answering the second in the general case is equivalent to solving the halting problem. But answering the first question is much simpler. Static analyzers aren't using a heuristic approach to the second question, they're solving a completely different problem.