[clang] 771d7d7 - [clang][dataflow] HTMLLogger: Don't crash if CFG contains unreachable blocks.

Martin Braenne via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 27 06:02:51 PDT 2023


Author: Martin Braenne
Date: 2023-07-27T13:02:42Z
New Revision: 771d7d71df418f12c80632ec6c3488af98f9b196

URL: https://github.com/llvm/llvm-project/commit/771d7d71df418f12c80632ec6c3488af98f9b196
DIFF: https://github.com/llvm/llvm-project/commit/771d7d71df418f12c80632ec6c3488af98f9b196.diff

LOG: [clang][dataflow] HTMLLogger: Don't crash if CFG contains unreachable blocks.

Reviewed By: sammccall

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

Added: 
    

Modified: 
    clang/lib/Analysis/FlowSensitive/HTMLLogger.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Analysis/FlowSensitive/HTMLLogger.cpp b/clang/lib/Analysis/FlowSensitive/HTMLLogger.cpp
index ee89e074f84676..ea9052b0e7171e 100644
--- a/clang/lib/Analysis/FlowSensitive/HTMLLogger.cpp
+++ b/clang/lib/Analysis/FlowSensitive/HTMLLogger.cpp
@@ -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";


        


More information about the cfe-commits mailing list