NULL successors exposed via GraphTraits

Clang’s CFG construction introduces NULL successors for infeasible paths.
These are exposed via GraphTraits iterators, which is currently unhandled in LLVM code, e.g. in llvm::DFSPass(…)

To reproduce:
$ echo “int main() { return 0 ? 0 : 0; }” | clang -cc1 -analyze -analyzer-checker=debug.DumpDominators -x c -
segfaults in llvm::DFSPass()

The question is, should this be fixed in LLVM or Clang?
I’m attaching a patch for llvm::DFSPass(), but I suppose there are other pieces in LLVM that would need adaption…

This is also assigned to the Clang static analyzer folks in Bugzilla #16085 [1].


null_succ_DFSPass.diff (658 Bytes)