llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang-analysis

Author: Igor Kudrin (igorkudrin)

<details>
<summary>Changes</summary>

The second parameter is unused since 6080d32194.

---
Full diff: https://github.com/llvm/llvm-project/pull/147897.diff


1 Files Affected:

- (modified) clang/lib/Analysis/UninitializedValues.cpp (+6-6) 


``````````diff
diff --git a/clang/lib/Analysis/UninitializedValues.cpp 
b/clang/lib/Analysis/UninitializedValues.cpp
index b2a68b6c39a7e..651b5777ddfd7 100644
--- a/clang/lib/Analysis/UninitializedValues.cpp
+++ b/clang/lib/Analysis/UninitializedValues.cpp
@@ -161,8 +161,7 @@ class CFGBlockValues {
 
   ValueVector::reference operator[](const VarDecl *vd);
 
-  Value getValue(const CFGBlock *block, const CFGBlock *dstBlock,
-                 const VarDecl *vd) {
+  Value getValue(const CFGBlock *block, const VarDecl *vd) {
     std::optional<unsigned> idx = declToIndex.getValueIndex(vd);
     return getValueVector(block)[*idx];
   }
@@ -589,12 +588,12 @@ class TransferFunctions : public 
StmtVisitor<TransferFunctions> {
         if (!Pred)
           continue;
 
-        Value AtPredExit = vals.getValue(Pred, B, vd);
+        Value AtPredExit = vals.getValue(Pred, vd);
         if (AtPredExit == Initialized)
           // This block initializes the variable.
           continue;
         if (AtPredExit == MayUninitialized &&
-            vals.getValue(B, nullptr, vd) == Uninitialized) {
+            vals.getValue(B, vd) == Uninitialized) {
           // This block declares the variable (uninitialized), and is reachable
           // from a block that initializes the variable. We can't guarantee to
           // give an earlier location for the diagnostic (and it appears that
@@ -625,6 +624,8 @@ class TransferFunctions : public 
StmtVisitor<TransferFunctions> {
     // Scan the frontier, looking for blocks where the variable was
     // uninitialized.
     for (const auto *Block : cfg) {
+      if (vals.getValue(Block, vd) != Uninitialized)
+        continue;
       unsigned BlockID = Block->getBlockID();
       const Stmt *Term = Block->getTerminatorStmt();
       if (SuccsVisited[BlockID] && SuccsVisited[BlockID] < Block->succ_size() 
&&
@@ -635,8 +636,7 @@ class TransferFunctions : public 
StmtVisitor<TransferFunctions> {
         for (CFGBlock::const_succ_iterator I = Block->succ_begin(),
              E = Block->succ_end(); I != E; ++I) {
           const CFGBlock *Succ = *I;
-          if (Succ && SuccsVisited[Succ->getBlockID()] >= Succ->succ_size() &&
-              vals.getValue(Block, Succ, vd) == Uninitialized) {
+          if (Succ && SuccsVisited[Succ->getBlockID()] >= Succ->succ_size()) {
             // Switch cases are a special case: report the label to the caller
             // as the 'terminator', not the switch statement itself. Suppress
             // situations where no label matched: we can't be sure that's

``````````

</details>


https://github.com/llvm/llvm-project/pull/147897
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to