[PATCH] D52284: [analyzer] Fix bug in isInevitablySinking

George Karpenkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 21 13:40:12 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL342766: [analyzer] Fix bug in isInevitablySinking (authored by george.karpenkov, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D52284?vs=166192&id=166548#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D52284

Files:
  cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp


Index: cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp
===================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp
@@ -2812,16 +2812,15 @@
     DFSWorkList.pop_back();
     Visited.insert(Blk);
 
+    // If at least one path reaches the CFG exit, it means that control is
+    // returned to the caller. For now, say that we are not sure what
+    // happens next. If necessary, this can be improved to analyze
+    // the parent StackFrameContext's call site in a similar manner.
+    if (Blk == &Cfg.getExit())
+      return false;
+
     for (const auto &Succ : Blk->succs()) {
       if (const CFGBlock *SuccBlk = Succ.getReachableBlock()) {
-        if (SuccBlk == &Cfg.getExit()) {
-          // If at least one path reaches the CFG exit, it means that control is
-          // returned to the caller. For now, say that we are not sure what
-          // happens next. If necessary, this can be improved to analyze
-          // the parent StackFrameContext's call site in a similar manner.
-          return false;
-        }
-
         if (!isImmediateSinkBlock(SuccBlk) && !Visited.count(SuccBlk)) {
           // If the block has reachable child blocks that aren't no-return,
           // add them to the worklist.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52284.166548.patch
Type: text/x-patch
Size: 1344 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180921/4a309fba/attachment.bin>


More information about the llvm-commits mailing list