[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 7 06:38:29 PDT 2026


https://github.com/benedekaibas updated https://github.com/llvm/llvm-project/pull/221727

>From b864364327448505a9d2911de02cb3f55c72fe06 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/2] [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 8eab3f19dc0a8..cbcc0c7d3b717 100644
--- a/clang/lib/StaticAnalyzer/Core/CallEvent.cpp
+++ b/clang/lib/StaticAnalyzer/Core/CallEvent.cpp
@@ -285,10 +285,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 = getAdjustedParameterIndex(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 7c0f02d11535ceeba342e2328d4d432b5afdd50e 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/2] 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 cbcc0c7d3b717..4eed56b2963b5 100644
--- a/clang/lib/StaticAnalyzer/Core/CallEvent.cpp
+++ b/clang/lib/StaticAnalyzer/Core/CallEvent.cpp
@@ -286,7 +286,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));



More information about the llvm-branch-commits mailing list