@@ -161,8 +161,7 @@ class CFGBlockValues {
161
161
162
162
ValueVector::reference operator [](const VarDecl *vd);
163
163
164
- Value getValue (const CFGBlock *block, const CFGBlock *dstBlock,
165
- const VarDecl *vd) {
164
+ Value getValue (const CFGBlock *block, const VarDecl *vd) {
166
165
std::optional<unsigned > idx = declToIndex.getValueIndex (vd);
167
166
return getValueVector (block)[*idx];
168
167
}
@@ -589,12 +588,12 @@ class TransferFunctions : public StmtVisitor<TransferFunctions> {
589
588
if (!Pred)
590
589
continue ;
591
590
592
- Value AtPredExit = vals.getValue (Pred, B, vd);
591
+ Value AtPredExit = vals.getValue (Pred, vd);
593
592
if (AtPredExit == Initialized)
594
593
// This block initializes the variable.
595
594
continue ;
596
595
if (AtPredExit == MayUninitialized &&
597
- vals.getValue (B, nullptr , vd) == Uninitialized) {
596
+ vals.getValue (B, vd) == Uninitialized) {
598
597
// This block declares the variable (uninitialized), and is reachable
599
598
// from a block that initializes the variable. We can't guarantee to
600
599
// give an earlier location for the diagnostic (and it appears that
@@ -625,6 +624,8 @@ class TransferFunctions : public StmtVisitor<TransferFunctions> {
625
624
// Scan the frontier, looking for blocks where the variable was
626
625
// uninitialized.
627
626
for (const auto *Block : cfg) {
627
+ if (vals.getValue (Block, vd) != Uninitialized)
628
+ continue ;
628
629
unsigned BlockID = Block->getBlockID ();
629
630
const Stmt *Term = Block->getTerminatorStmt ();
630
631
if (SuccsVisited[BlockID] && SuccsVisited[BlockID] < Block->succ_size () &&
@@ -635,8 +636,7 @@ class TransferFunctions : public StmtVisitor<TransferFunctions> {
635
636
for (CFGBlock::const_succ_iterator I = Block->succ_begin (),
636
637
E = Block->succ_end (); I != E; ++I) {
637
638
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 ()) {
640
640
// Switch cases are a special case: report the label to the caller
641
641
// as the 'terminator', not the switch statement itself. Suppress
642
642
// situations where no label matched: we can't be sure that's
0 commit comments