[clang] [clang][analyzer] Improve modeling of 'fseeko' and 'ftello' in StdLibraryFunctionsChecker (PR #77902)

Balázs Kéri via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 12 07:21:49 PST 2024


================
@@ -2859,13 +2859,19 @@ void StdLibraryFunctionsChecker::initFunctionSummaries(
         "fseeko",
         Signature(ArgTypes{FilePtrTy, Off_tTy, IntTy}, RetType{IntTy}),
         Summary(NoEvalCall)
-            .Case(ReturnsZeroOrMinusOne, ErrnoIrrelevant)
-            .ArgConstraint(NotNull(ArgNo(0))));
+            .Case(ReturnsZero, ErrnoMustNotBeChecked, GenericSuccessMsg)
+            .Case(ReturnsMinusOne, ErrnoNEZeroIrrelevant, GenericFailureMsg)
+            .ArgConstraint(NotNull(ArgNo(0)))
+            .ArgConstraint(ArgumentCondition(2, WithinRange, {{0, 2}})));
----------------
balazske wrote:

Please move the code of function `fseeko` to after `fseek`, and `ftello` after `ftell`.

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


More information about the cfe-commits mailing list