]> granicus.if.org Git - clang/commit
[Dominators] PR42041: Skip nullpointer successors
authorKristof Umann <dkszelethus@gmail.com>
Wed, 3 Jul 2019 11:14:42 +0000 (11:14 +0000)
committerKristof Umann <dkszelethus@gmail.com>
Wed, 3 Jul 2019 11:14:42 +0000 (11:14 +0000)
commit663ca222973b595768d1f8472df02afa87c9b460
tree9f31806faf6ba66fdc1fe243a431d7b451964c6a
parentee915ad903e0d476c07d0398b42b2970a4dc4b19
[Dominators] PR42041: Skip nullpointer successors

https://bugs.llvm.org/show_bug.cgi?id=42041

In Clang's CFG, we use nullpointers to represent unreachable nodes, for
example, in the included testfile, block B0 is unreachable from block
B1, resulting in a nullpointer dereference somewhere in
llvm::DominatorTreeBase<clang::CFGBlock, false>::recalculate.

This patch fixes this issue by specializing
llvm::DomTreeBuilder::SemiNCAInfo::ChildrenGetter::Get for
clang::CFG to not contain nullpointer successors.

Differential Revision: https://reviews.llvm.org/D62507

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365026 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Analysis/Analyses/Dominators.h
test/Analysis/domtest.c
test/Analysis/domtest.cpp [new file with mode: 0644]