11 Commits

Author SHA1 Message Date
Balázs Kéri
be50ada9d0
[clang][analyzer] Refine modeling of 'getcwd' in StdCLibraryFunctions checker (#141076)
Add extra branches for the case when the buffer argument is NULL.

Fixes #135720
2025-05-23 09:26:31 +02:00
Congcong Cai
0851d7b00c
[clang][analyzer] use unqualified canonical type during merging equivalence class (#95729)
Fixes: #95658
Unqualified canonical type should be used instead of normal QualType for
type equality comparison
2024-06-17 23:37:34 +08:00
Ben Shi
c12f30c7ff
[clang][analyzer] Improve modeling of 'realpath' in StdLibraryFunctionsChecker (#79939) 2024-01-31 12:50:23 +08:00
Ben Shi
ff05c3087b
[clang][analyzer] Improve modeling of 'popen' and 'pclose' in StdLibraryFunctionsChecker (#78895) 2024-01-27 09:46:05 +08:00
Ben Shi
b7f986d987
[clang][analyzer] Improve modeling of 'execv' and 'execvp' in StdLibraryFunctionsChecker (#78930)
These functions always return -1 and set 'errno'.
2024-01-25 09:23:40 +08:00
Ben Shi
7dd20637c8
Improve modeling of 'getcwd' in the StdLibraryFunctionsChecker (#77040)
1. Improve the 'errno' modeling.
2. Improve constraints of the arguments.
2024-01-09 09:27:57 +08:00
Ben Shi
3db749afcb
[clang][analyzer] Improve 'errno' modeling of 'mkdtemp' (#76671) 2024-01-03 18:23:45 +08:00
Balázs Kéri
72d3bf2b87
[clang][Analyzer] Move checker 'alpha.unix.Errno' to 'unix.Errno'. (#69469) 2023-11-21 13:34:03 +01:00
Balázs Kéri
c202a17d02
[clang][analyzer] Move checker alpha.unix.StdCLibraryFunctions out of alpha. (#66207) 2023-10-16 14:51:05 +02:00
Balázs Kéri
4f0436dd15 [clang][analyzer] Merge apiModeling.StdCLibraryFunctions and StdCLibraryFunctionArgs checkers into one.
Main reason for this change is that these checkers were implemented in the same class
but had different dependency ordering. (NonNullParamChecker should run before StdCLibraryFunctionArgs
to get more special warning about null arguments, but the apiModeling.StdCLibraryFunctions was a modeling
checker that should run before other non-modeling checkers. The modeling checker changes state in a way
that makes it impossible to detect a null argument by NonNullParamChecker.)
To make it more simple, the modeling part is removed as separate checker and can be only used if
checker StdCLibraryFunctions is turned on, that produces the warnings too. Modeling the functions
without bug detection (for invalid argument) is not possible. The modeling of standard functions
does not happen by default from this change on.

Reviewed By: Szelethus

Differential Revision: https://reviews.llvm.org/D151225
2023-06-01 09:54:35 +02:00
Balázs Kéri
957014da2d [clang][Analyzer] Add errno state to standard functions modeling.
This updates StdLibraryFunctionsChecker to set the state of 'errno'
by using the new errno_modeling functionality.
The errno value is set in the PostCall callback. Setting it in call::Eval
did not work for some reason and then every function should be
EvalCallAsPure which may be bad to do. Now the errno value and state
is not allowed to be checked in any PostCall checker callback because
it is unspecified if the errno was set already or will be set later
by this checker.

Reviewed By: martong, steakhal

Differential Revision: https://reviews.llvm.org/D125400
2022-06-21 08:56:41 +02:00