[clang] [clang][analyzer] StreamChecker: Add more APIs, invalidate fscanf args (PR #82476)

via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 21 03:35:35 PST 2024


================
@@ -171,14 +173,34 @@ using FnCheck = std::function<void(const StreamChecker *, const FnDescription *,
                                    const CallEvent &, CheckerContext &)>;
 
 using ArgNoTy = unsigned int;
-static const ArgNoTy ArgNone = std::numeric_limits<ArgNoTy>::max();
+const ArgNoTy ArgNone = std::numeric_limits<ArgNoTy>::max();
 
 struct FnDescription {
   FnCheck PreFn;
   FnCheck EvalFn;
   ArgNoTy StreamArgNo;
 };
 
+[[nodiscard]] ProgramStateRef
+escapeArgsAfterIndex(ProgramStateRef State, CheckerContext &C,
+                     const CallEvent &Call, unsigned FirstEscapingArgIndex) {
----------------
NagyDonat wrote:

I dislike the inconsistency between the names `escapeArgsAfterIndex` and `FirstEscapingArgIndex`: the name of the function strongly suggests that its argument would be the index of the _last non-escaping_ argument. Consider renaming the function to `escapeArgsStartingFromIndex` (which is admittedly awkward but at least not misleading) or something similar.

https://github.com/llvm/llvm-project/pull/82476


More information about the cfe-commits mailing list