[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
Thu Sep 10 03:28:29 PDT 2026
https://github.com/benedekaibas updated https://github.com/llvm/llvm-project/pull/221727
>From e7abbe9c75356ebed5f25bdf4b01ccd90d0c5606 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 59a9c7725e8bd..5dc2482be853a 100644
--- a/clang/lib/StaticAnalyzer/Core/CallEvent.cpp
+++ b/clang/lib/StaticAnalyzer/Core/CallEvent.cpp
@@ -288,10 +288,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 626d568bfbe5019e4f44af3edd449b2298c15cde 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 5dc2482be853a..919025ec03218 100644
--- a/clang/lib/StaticAnalyzer/Core/CallEvent.cpp
+++ b/clang/lib/StaticAnalyzer/Core/CallEvent.cpp
@@ -289,7 +289,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 8f03efed3877aea0c5a778d0ffa41d81c74971c1 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 919025ec03218..5ff46832c54d7 100644
--- a/clang/lib/StaticAnalyzer/Core/CallEvent.cpp
+++ b/clang/lib/StaticAnalyzer/Core/CallEvent.cpp
@@ -289,11 +289,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