[clang] [clang][NFC] Remove an unused parameter in CFGBlockValues::getValue() (PR #147897)
Igor Kudrin via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 9 23:32:46 PDT 2025
https://github.com/igorkudrin created https://github.com/llvm/llvm-project/pull/147897
The second parameter is unused since 6080d32194.
>From 748a7ad92ed59854502ff5c3b28dfb18f8e08c79 Mon Sep 17 00:00:00 2001
From: Igor Kudrin <ikudrin at accesssoftek.com>
Date: Wed, 9 Jul 2025 18:49:32 -0700
Subject: [PATCH] [clang][NFC] Remove an unused parameter in
CFGBlockValues::getValue()
The second parameter is unused since 6080d32194.
---
clang/lib/Analysis/UninitializedValues.cpp | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
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
More information about the cfe-commits
mailing list