@@ -161,8 +161,7 @@ class CFGBlockValues {
161161
162162 ValueVector::reference operator [](const VarDecl *vd);
163163
164- Value getValue (const CFGBlock *block, const CFGBlock *dstBlock,
165- const VarDecl *vd) {
164+ Value getValue (const CFGBlock *block, const VarDecl *vd) {
166165 std::optional<unsigned > idx = declToIndex.getValueIndex (vd);
167166 return getValueVector (block)[*idx];
168167 }
@@ -589,12 +588,12 @@ class TransferFunctions : public StmtVisitor<TransferFunctions> {
589588 if (!Pred)
590589 continue ;
591590
592- Value AtPredExit = vals.getValue (Pred, B, vd);
591+ Value AtPredExit = vals.getValue (Pred, vd);
593592 if (AtPredExit == Initialized)
594593 // This block initializes the variable.
595594 continue ;
596595 if (AtPredExit == MayUninitialized &&
597- vals.getValue (B, nullptr , vd) == Uninitialized) {
596+ vals.getValue (B, vd) == Uninitialized) {
598597 // This block declares the variable (uninitialized), and is reachable
599598 // from a block that initializes the variable. We can't guarantee to
600599 // give an earlier location for the diagnostic (and it appears that
@@ -625,6 +624,8 @@ class TransferFunctions : public StmtVisitor<TransferFunctions> {
625624 // Scan the frontier, looking for blocks where the variable was
626625 // uninitialized.
627626 for (const auto *Block : cfg) {
627+ if (vals.getValue (Block, vd) != Uninitialized)
628+ continue ;
628629 unsigned BlockID = Block->getBlockID ();
629630 const Stmt *Term = Block->getTerminatorStmt ();
630631 if (SuccsVisited[BlockID] && SuccsVisited[BlockID] < Block->succ_size () &&
@@ -635,8 +636,7 @@ class TransferFunctions : public StmtVisitor<TransferFunctions> {
635636 for (CFGBlock::const_succ_iterator I = Block->succ_begin (),
636637 E = Block->succ_end (); I != E; ++I) {
637638 const CFGBlock *Succ = *I;
638- if (Succ && SuccsVisited[Succ->getBlockID ()] >= Succ->succ_size () &&
639- vals.getValue (Block, Succ, vd) == Uninitialized) {
639+ if (Succ && SuccsVisited[Succ->getBlockID ()] >= Succ->succ_size ()) {
640640 // Switch cases are a special case: report the label to the caller
641641 // as the 'terminator', not the switch statement itself. Suppress
642642 // situations where no label matched: we can't be sure that's
0 commit comments