[llvm-branch-commits] [clang] [analyzer] Replace getAdjustedParameterIndex with getDeclaredParameterIndex in CallEvent.cpp (PR #221727)
Benedek Kaibas via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Sep 14 05:11:51 PDT 2026
https://github.com/benedekaibas updated https://github.com/llvm/llvm-project/pull/221727
>From 4044dc1ba71f0c8e30c224662b035c44d5a93818 Mon Sep 17 00:00:00 2001
From: benedekaibas <kaibas01 at allegheny.edu>
Date: Mon, 7 Sep 2026 15:22:38 +0200
Subject: [PATCH 1/3] [analyzer] Replace getAdjustedParameterIndex with
getDeclaredParameterIndex in CallEvent.cpp
---
clang/lib/StaticAnalyzer/Core/CallEvent.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/clang/lib/StaticAnalyzer/Core/CallEvent.cpp b/clang/lib/StaticAnalyzer/Core/CallEvent.cpp
index fd8ffd2a4db3d..aa19369c49783 100644
--- a/clang/lib/StaticAnalyzer/Core/CallEvent.cpp
+++ b/clang/lib/StaticAnalyzer/Core/CallEvent.cpp
@@ -289,10 +289,10 @@ ProgramStateRef CallEvent::invalidateRegions(unsigned BlockCount,
// TODO: This is unnecessary when there's no destructor, but that's
// currently hard to figure out.
if (getKind() != CE_CXXAllocator)
- if (isArgumentConstructedDirectly(Idx))
- if (auto AdjIdx = adjustASTArgIdxToDeclParamIdx(Idx))
+ if (isArgumentConstructedDirectly(getASTArgumentIndex(Idx)))
+ if (std::optional<unsigned> DeclParamIdx = getDeclaredParameterIndex(Idx))
if (const TypedValueRegion *TVR =
- getParameterLocation(*AdjIdx, BlockCount))
+ getParameterLocation(*DeclParamIdx, BlockCount))
ValuesToInvalidate.push_back(loc::MemRegionVal(TVR));
}
>From 6594f9356bdf709c002993cbe4b4e3907e87c826 Mon Sep 17 00:00:00 2001
From: benedekaibas <kaibas01 at allegheny.edu>
Date: Mon, 7 Sep 2026 15:36:43 +0200
Subject: [PATCH 2/3] Run clang-format once again.
---
clang/lib/StaticAnalyzer/Core/CallEvent.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/clang/lib/StaticAnalyzer/Core/CallEvent.cpp b/clang/lib/StaticAnalyzer/Core/CallEvent.cpp
index aa19369c49783..3d7804b64d07e 100644
--- a/clang/lib/StaticAnalyzer/Core/CallEvent.cpp
+++ b/clang/lib/StaticAnalyzer/Core/CallEvent.cpp
@@ -290,7 +290,8 @@ ProgramStateRef CallEvent::invalidateRegions(unsigned BlockCount,
// currently hard to figure out.
if (getKind() != CE_CXXAllocator)
if (isArgumentConstructedDirectly(getASTArgumentIndex(Idx)))
- if (std::optional<unsigned> DeclParamIdx = getDeclaredParameterIndex(Idx))
+ if (std::optional<unsigned> DeclParamIdx =
+ getDeclaredParameterIndex(Idx))
if (const TypedValueRegion *TVR =
getParameterLocation(*DeclParamIdx, BlockCount))
ValuesToInvalidate.push_back(loc::MemRegionVal(TVR));
>From fd50959b724d3073de36a0132565a8538a099e4b Mon Sep 17 00:00:00 2001
From: benedekaibas <kaibas01 at allegheny.edu>
Date: Thu, 10 Sep 2026 12:27:59 +0200
Subject: [PATCH 3/3] Move getDeclaredParameterIndex as param to
getParameterLocation.
---
clang/lib/StaticAnalyzer/Core/CallEvent.cpp | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/clang/lib/StaticAnalyzer/Core/CallEvent.cpp b/clang/lib/StaticAnalyzer/Core/CallEvent.cpp
index 3d7804b64d07e..b2c81be96a6bb 100644
--- a/clang/lib/StaticAnalyzer/Core/CallEvent.cpp
+++ b/clang/lib/StaticAnalyzer/Core/CallEvent.cpp
@@ -290,11 +290,9 @@ ProgramStateRef CallEvent::invalidateRegions(unsigned BlockCount,
// currently hard to figure out.
if (getKind() != CE_CXXAllocator)
if (isArgumentConstructedDirectly(getASTArgumentIndex(Idx)))
- if (std::optional<unsigned> DeclParamIdx =
- getDeclaredParameterIndex(Idx))
- if (const TypedValueRegion *TVR =
- getParameterLocation(*DeclParamIdx, BlockCount))
- ValuesToInvalidate.push_back(loc::MemRegionVal(TVR));
+ if (const TypedValueRegion *TVR = getParameterLocation(
+ getDeclaredParameterIndex(Idx), BlockCount))
+ ValuesToInvalidate.push_back(loc::MemRegionVal(TVR));
}
// Invalidate designated regions using the batch invalidation API.
More information about the llvm-branch-commits
mailing list