Skip to content

Commit

Permalink
[clang][dataflow] HTMLLogger: Don't crash if CFG contains unreachable…
Browse files Browse the repository at this point in the history
… blocks.

Reviewed By: sammccall

Differential Revision: https://reviews.llvm.org/D156411
  • Loading branch information
martinboehme committed Jul 27, 2023
1 parent 95e5a46 commit 771d7d7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions clang/lib/Analysis/FlowSensitive/HTMLLogger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -462,8 +462,9 @@ class HTMLLogger : public Logger {
GraphS << " " << blockID(I) << " [id=" << blockID(I) << "]\n";
for (const auto *Block : CFG) {
for (const auto &Succ : Block->succs()) {
GraphS << " " << blockID(Block->getBlockID()) << " -> "
<< blockID(Succ.getReachableBlock()->getBlockID()) << "\n";
if (Succ.getReachableBlock())
GraphS << " " << blockID(Block->getBlockID()) << " -> "
<< blockID(Succ.getReachableBlock()->getBlockID()) << "\n";
}
}
GraphS << "}\n";
Expand Down

0 comments on commit 771d7d7

Please sign in to comment.