[clang] [clang][analyzer] Fix argument invalidations in StreamChecker. (PR #79470)
Balazs Benics via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 25 11:42:10 PST 2024
================
@@ -544,6 +545,21 @@ const ExplodedNode *StreamChecker::getAcquisitionSite(const ExplodedNode *N,
return nullptr;
}
+static ProgramStateRef
+escapeArgs(ProgramStateRef State, CheckerContext &C, const CallEvent &Call,
+ const SmallVector<unsigned int> &EscapingArgs) {
+ const auto *CE = Call.getOriginExpr();
+
+ SmallVector<SVal> EscapingVals;
+ EscapingVals.reserve(EscapingArgs.size());
+ for (auto EscArgIdx : EscapingArgs)
+ EscapingVals.push_back(Call.getArgSVal(EscArgIdx));
+ State = State->invalidateRegions(EscapingVals, CE, C.blockCount(),
+ C.getLocationContext(),
+ /*CausesPointerEscape=*/false);
----------------
steakhal wrote:
```suggestion
State = State->invalidateRegions(EscapingVals, CE, C.blockCount(),
C.getLocationContext(),
/*CausesPointerEscape=*/false, /*InvalidatedSymbols=*/nullptr, &Call);
```
I can't recall now what difference it makes to pass the `Call` to this API, but given that we have one, why not?
https://github.com/llvm/llvm-project/pull/79470
More information about the cfe-commits
mailing list