]> granicus.if.org Git - clang/commitdiff
[analyzer] Fix a bug in unexplored_first_location_queue iteration order.
authorGeorge Karpenkov <ekarpenkov@apple.com>
Fri, 12 Oct 2018 00:52:13 +0000 (00:52 +0000)
committerGeorge Karpenkov <ekarpenkov@apple.com>
Fri, 12 Oct 2018 00:52:13 +0000 (00:52 +0000)
Pointed out by Artem in post-commit review for https://reviews.llvm.org/D53058

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@344322 91177308-0d34-0410-b5e6-96231b3b80d8

lib/StaticAnalyzer/Core/WorkList.cpp

index 9eb3ee87fb767e1f661442684ee8a98998adfead..e25f94f572929228cb6c95c2b796a87b57bb0da6 100644 (file)
@@ -255,7 +255,7 @@ std::unique_ptr<WorkList> WorkList::makeUnexploredFirstPriorityQueue() {
 
 namespace {
 class UnexploredFirstPriorityLocationQueue : public WorkList {
-  using LocIdentifier = int;
+  using LocIdentifier = const CFGBlock *;
 
   // How many times each location was visited.
   // Is signed because we negate it later in order to have a reversed
@@ -294,7 +294,7 @@ public:
     const ExplodedNode *N = U.getNode();
     unsigned NumVisited = 0;
     if (auto BE = N->getLocation().getAs<BlockEntrance>())
-      NumVisited = NumReached[BE->getBlock()->getBlockID()]++;
+      NumVisited = NumReached[BE->getBlock()]++;
 
     queue.push(std::make_pair(U, std::make_pair(-NumVisited, ++Counter)));
   }