================
@@ -1250,9 +1250,22 @@ class FallthroughMapper : public
DynamicRecursiveASTVisitor {
while (!BlockQueue.empty()) {
const CFGBlock *P = BlockQueue.front();
BlockQueue.pop_front();
- for (const CFGBlock *B : P->succs()) {
+ // The code after an 'analyzer_noreturn' call isn't dead, since the call
+ // can return. The CFG keeps that code as the alternate successor of the
+ // exit edge, so follow it too.
+ bool FollowAlternate = P->hasOnlyAnalyzerNoReturnElement();
+ for (const CFGBlock::AdjacentBlock &Succ : P->succs()) {
+ const CFGBlock *B = Succ.getReachableBlock();
if (B && ReachableBlocks.insert(B).second)
BlockQueue.push_back(B);
+ if (!FollowAlternate)
+ continue;
+ const CFGBlock *Alt = Succ.getPossiblyUnreachableBlock();
+ assert(B && Alt != B &&
+ "noreturn edge should have a reachable block and a distinct "
+ "alternate");
+ if (Alt && ReachableBlocks.insert(Alt).second)
+ BlockQueue.push_back(Alt);
----------------
steakhal wrote:
`B` is from `Succ.getReachableBlock()`. On the next line, it’s checked against
null.
Then we have this assert that now asserts that it's non-null.
Can this assert fire because `B` is null? Or why does the code check `B`?
https://github.com/llvm/llvm-project/pull/242121
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits