194 Commits

Author SHA1 Message Date
Balázs Kéri
ffeb793f3a
[clang][analyzer][docs] Fix documentation of checker 'StackAddrAsyncEscape' (NFC) (#108586)
The checker was indicated as a 'C' language checker but is only applicable to 'ObjC' code.
2024-09-13 17:51:28 +02:00
Balázs Kéri
525ffd6262
[clang][analyzer] Bring alpha.security.MmapWriteExec checker out of alpha package (#102636) 2024-09-03 10:31:36 +02:00
Arseniy Zaostrovnykh
4f33e7c683
[analyzer] Report violations of the "returns_nonnull" attribute (#106048)
Make sure code respects the GNU-extension `__attribute__((returns_nonnull))`.

Extend the NullabilityChecker to check that a function returns_nonnull
does not return a nullptr.

This commit also reverts an old hack introduced by
49bd58f1ebe28d97e4949e9c757bc5dfd8b2d72f
because it is no longer needed

CPP-4741
2024-08-27 14:41:52 +02:00
Donát Nagy
340be6cb79
[analyzer] Delete alpha.security.MallocOverflow (#103059)
...because it is too noisy to be useful right now, and its architecture
is terrible, so it can't act a starting point of future development.

The main problem with this checker is that it tries to do (or at least
fake) path-sensitive analysis without actually using the established
path-sensitive analysis engine.

Instead of actually tracking the symbolic values and the known
constraints on them, this checker blindly gropes the AST and uses
heuristics like "this variable was seen in a comparison operator
expression that is not a loop condition, so it's probably not too large"
(which was improved in a separate commit to at least ignore comparison
operators that appear after the actual `malloc()` call).

This might have been acceptable in 2011 (when this checker was added),
but since then we developed a significantly better standard approach for
analysis and this old relic doesn't deserve to remain in the codebase.

Needless to say, this primitive approach causes lots of false positives
(and presumably false negatives as well), which ensures that this alpha
checker won't be missed by the users.

Moreover, the goals of this checker would be questionable even if it had
a perfect implementation. It's very aggressive to assume that the
argument of malloc can overflow by default (unless the checker sees a
bounds check); and this produces too many false positives -- perhaps
even for an optin checker. It may be possible to eventually create a
useful (and properly path-sensitive) optin checker for these kinds of
suspicious code, but this is a very low priority goal.

Also note that we already have `alpha.security.TaintedAlloc` which
provides more practical heuristics for detecting somewhat similar
"argument of malloc may be too large" vulnerabilities.
2024-08-14 15:07:42 +02:00
Balázs Kéri
e607360fcd
[clang][analyzer] Remove array bounds check from PointerSubChecker (#102580)
At pointer subtraction only pointers are allowed that point into an
array (or one after the end), this fact was checker by the checker. This
check is now removed because it is a special case of array indexing
error that is handled by different checkers (like ArrayBoundsV2).
2024-08-12 11:22:30 +02:00
Balázs Kéri
cab91ecffd
[clang][analyzer] Improve PointerSubChecker (#96501)
The checker could report false positives if pointer arithmetic was done
on pointers to non-array data before pointer subtraction. Another
problem is fixed that could cause false positive if members of the same
structure but in different memory objects are subtracted.
2024-08-01 12:56:25 +02:00
Balazs Benics
13d39cb6f7
[analyzer] Fix crash of StreamChecker when eval calling 'fopen' (#100990)
Actually, on the failure branch of `fopen`, the resulting pointer could
alias with `stdout` iff `stdout` is already known to be null.
We crashed in this case as the implementation assumed that the
state-split for creating the success and failure branches both should be
viable; thus dereferenced both of those states - leading to the crash.

To fix this, let's just only add this no-alias property for the success
path, and that's it :)

Fixes #100901
2024-07-29 14:15:02 +02:00
Pavel Skripkin
893a303962
[clang][analyzer] Support ownership_{returns,takes} attributes (#98941)
Add support for checking mismatched ownership_returns/ownership_takes attributes.

Closes #76861
2024-07-24 13:15:08 +02:00
Daniel Krupp
6002e2fd49
[analyzer] Split TaintPropagation checker into reporting and modeling checkers (#98157)
Taint propagation is a a generic modeling feature of the Clang Static
Analyzer which many other checkers depend on. Therefore
GenericTaintChecker is split into a TaintPropagation modeling checker
and a GenericTaint reporting checker.
2024-07-10 17:54:53 +02:00
Endre Fülöp
093aaca2b0
[clang][analyzer][doc] Migrate user-related docs from HTML to RST (#97034)
User documentation currently found at https://clang-analyzer.llvm.org is migrated to RST format.

This commit migrates all the relevant content, including suspicious or even clearly outdated parts. These issues will be cleaned up in separate follow-up commits (where the diff is not obscured by the format change). However, a few typos are fixed, and some parts (availability of binary releases, integration with XCode) are marked (with [Legacy] tags) to highlight that they are outdated.

The primary motivation for this change is to update the facts in the docs and make them discoverable from the RST-generated doc-tree as well (many subpages are not accessible at all, as the menu generation for the HTML-based page is not working at all).


This commit migrates all the relevant content, including parts that are
suspicious or even clearly outdated. These issues will be cleaned up in
separate follow-up commits (where the diff is not obscured by the format
change). However, a few typos are fixed and some parts (availability of
binary releases, integration with XCode) are marked (with [Legacy] tags)
to highlight that they are outdated.

The primary motivation for this change is to update the facts in the
docs and make them discoverable from the RST-generated doc-tree as well
(many subpages are not accessible **at all**, as the menu generation for
the HTML based page is not working at all).
2024-07-05 08:16:53 +02:00
Balázs Kéri
2341316929
[clang][analyzer] Improve documentation of checker 'cplusplus.Move' (NFC) (#96295) 2024-06-28 10:17:27 +02:00
Balázs Kéri
2e515ed60a
[clang] Move 'alpha.cplusplus.MisusedMovedObject' to 'cplusplus.Move' in documentation (NFC) (#95003)
The checker was renamed at some time ago but the documentation was not
updated. The section is now just moved and renamed. The documentation is
still very simple and needs improvement.
2024-06-20 16:41:51 +02:00
Donát Nagy
d9a508db55
[analyzer] Finish moving alpha.core.SizeofPtr to clang-tidy (#95118)
The checker `alpha.core.SizeofPtr` was a very simple checker that did
not rely on path sensitive analysis and was very similar to the (more
complex and refined) clang-tidy check `bugprone-sizeof-expression`.

As there is no reason to maintain two separate implementations for the
same goal (and clang-tidy is more lightweight and accessible than the
Analyzer) I decided to move this functionality from the Static Analyzer
to clang-tidy.

Recently my commit 546c816a529835a4cf89deecff957ea336a94fa2
reimplemented the advantageous parts of `alpha.core.SizeofPtr` within
clang-tidy; now this commit finishes the transfer by deleting
`alpha.core.SizeofPtr`.
2024-06-12 14:26:47 +02:00
Daniel Krupp
289725f11c
[analyzer] New optin.taint.TaintedAlloc checker for catching unbounded memory allocation calls (#92420)
A new optional checker (optin.taint.TaintedAlloc) will warn if a memory
allocation function (malloc, calloc, realloc, alloca, operator new[]) is
called with a tainted (attacker controlled) size parameter.
A large, maliciously set size value can trigger memory exhaustion. To
get this warning, the alpha.security.taint.TaintPropagation checker also
needs to be switched on.

The warning will only be emitted, if the analyzer cannot prove that the
size is below reasonable bounds (<SIZE_MAX/4).
2024-06-05 16:33:31 +02:00
Balázs Kéri
bc3baa93ce
[clang][analyzer] Move PutenvStackArrayChecker out of alpha package (#93980)
Checker alpha.security.PutenvStackArray is moved to
security.PutenvStackArray.
2024-06-04 10:02:38 +02:00
Endre Fülöp
6ef785c951
[clang][analyzer] Move unix.BlockInCriticalSection out of alpha (#93815)
After recent improvements (#80029) and testing on open-source projects,
the checker is ready to move out of the alpha package.
2024-06-03 14:23:58 +02:00
Endre Fülöp
46b3145b7c
[clang][analyzer][NFC] Add test for a limitation of alpha.unix.BlockInCriticalSection checker (#93799)
Updated the documentation in `checkers.rst` to include an example of how
`trylock` function is handled.
Added a new test for a scenario where `pthread_mutex_trylock` is used,
demonstrating the current limitation.
2024-05-31 12:51:14 +02:00
Endre Fülöp
196dca7561
[clang][analyzer][NFC] Improve docs of alpha.unix.BlockInCriticalSection (#93812)
- Enhanced descriptions for blocking and critical section functions
- Added an additional code sample highlighting interleaved C and C++
style mutexes
2024-05-31 12:50:04 +02:00
Balázs Kéri
76b9d38934
[clang][analyzer] PutenvStackArrayChecker: No warning from 'main' (#93299) 2024-05-27 09:55:10 +02:00
Balázs Kéri
3c23047413
[clang][analyzer] Move checker 'cert.pos.34c' (in alpha.security) into 'PutenvStackArray' (#92424)
The "cert" package looks not useful and the checker has not a meaningful name with the old naming scheme.
Additionally tests and documentation is updated.
2024-05-23 12:56:16 +02:00
Balázs Kéri
11b97da831
[clang][analyzer] Add checker 'security.SetgidSetuidOrder' (#91445) 2024-05-22 12:11:18 +02:00
Daniel Krupp
6ceb1c0ef9
[analyzer] Remove untrusted buffer size warning in the TaintPropagation checker (#68607)
Before this commit the the checker alpha.security.taint.TaintPropagation always reported warnings when the size argument of a memcpy-like or malloc-like function was tainted. However, this produced false positive reports in situations where the size was tainted, but correctly performed bound checks guaranteed the safety of the call.
 
This commit removes the rough "always warn if the size argument is tainted" heuristic; but it would be good to add a more refined "warns if the size argument is tainted and can be too large" heuristic in follow-up commits. That logic would belong to CStringChecker and MallocChecker, because those are the checkers responsible for the more detailed modeling of memcpy-like and malloc-like functions. To mark this plan, TODO comments are added in those two checkers.
 
There were several test cases that used these sinks to test generic properties of taint tracking; those were adapted to use different logic.
 
As a minor unrelated change, this commit ensures that strcat (and its wide variant, wcsncat) propagates taint from the first argument to the first argument, i.e. a tainted string remains tainted if we concatenate it with another string. This change was required because the adapted variant of multipleTaintedArgs is relying on strncat to compose a value that combines taint from two different sources.
2024-05-02 16:46:41 +02:00
Balázs Kéri
09f160c629
[clang][analyzer] Move StreamChecker out of the alpha package. (#89247) 2024-04-30 09:01:45 +02:00
Balázs Kéri
c2067c1f47
[clang][analyzer] Add "pedantic" mode to StreamChecker. (#87322)
The checker may create failure branches for all stream write operations
only if the new option "pedantic" is set to true.
Result of the write operations is often not checked in typical code. If
failure branches are created the checker will warn for unchecked write
operations and generate a lot of "false positives" (these are valid
warnings but the programmer does not care about this problem).
2024-04-08 12:19:03 +02:00
Balázs Kéri
8dcff10e9b
[clang][analyzer] Improve documentation of StreamChecker (NFC). (#83858) 2024-03-28 18:04:35 +01:00
komalverma04
b8cc838427
[analyzer][docs] Document the optin.performance.Padding checker (#86411)
Closes #73675

Co-authored-by: Balazs Benics <benicsbalazs@gmail.com>
Co-authored-by: NagyDonat <donat.nagy@ericsson.com>
2024-03-27 13:51:27 +01:00
Discookie
37785fedab
[clang][analyzer] Bring cplusplus.ArrayDelete out of alpha (#83985)
The checker finds a type of undefined behavior, where if the type of a
pointer to an object-array is different from the objects' underlying
type, calling `delete[]` is undefined, as the size of the two objects
might be different.

The checker has been in alpha for a while now, it is a simple checker
that causes no crashes, and considering the severity of the issue, it
has a low result-count on open-source projects (in my last test-run on
my usual projects, it had 0 results).

This commit cleans up the documentation and adds docs for the limitation
related to tracking through references, in addition to moving it to
`cplusplus`.

---------

Co-authored-by: Balazs Benics <benicsbalazs@gmail.com>
Co-authored-by: whisperity <whisperity@gmail.com>
2024-03-25 10:08:56 +00:00
Balázs Kéri
bbeb946652 [clang][analyzer] Change value of checker option in unix.StdCLibraryFunctions (second try). (#80457)
Default value of checker option `ModelPOSIX` is changed to `true`.
Documentation is updated.

This is a re-apply of commit 7af4e8bcc354d2bd7e46ecf547172b1f19ddde3e
that was reverted because a test failure (this is fixed now).
2024-03-04 15:28:20 +01:00
Balázs Kéri
da5966e0c1 Revert "[clang][analyzer] Change default value of checker option in unix.StdCLibraryFunctions. (#80457)"
This reverts commit 7af4e8bcc354d2bd7e46ecf547172b1f19ddde3e.
2024-03-04 09:50:36 +01:00
Balázs Kéri
7af4e8bcc3
[clang][analyzer] Change default value of checker option in unix.StdCLibraryFunctions. (#80457)
Default value of checker option `ModelPOSIX` is changed to `true`.
Documentation is updated.
2024-03-04 09:29:18 +01:00
Daniel Krupp
de04b7d44e
[analyzer] Fix core.VLASize checker false positive taint reports (#68140)
The checker reported a false positive on this code 

void testTaintedSanitizedVLASize(void) {
  int x;
  scanf("%d", &x);
  if (x<1)
    return;
  int vla[x]; // no-warning
}

After the fix, the checker only emits tainted warning if the vla size is
coming from a tainted source and it cannot prove that it is positive.
2024-02-23 11:44:34 +01:00
Balázs Kéri
2b5e4eeb26
[clang][analyzer] Remove 'alpha.core.CallAndMessageUnInitRefArg' from documentation (NFC). (#81138)
This checker does not exist (any more?) but appeared in the
documentation. No other references to CallAndMessageUnInitRefArg are
found in the full clang code.
2024-02-12 15:30:58 +01:00
Gábor Spaits
1d2fab74af
[analyzer] Add documentation for std::variant checker (#76501)
Add a short documentation for `StdVariantChecker`.

---------

Co-authored-by: Balazs Benics <benicsbalazs@gmail.com>
Co-authored-by: whisperity <whisperity@gmail.com>
Co-authored-by: DonatNagyE <donat.nagy@ericsson.com>
2023-12-28 22:19:51 +01:00
Balazs Benics
d488adb7c2
[analyzer][docs] Update the release notes for llvm-18 (#76446)
This PR prepares the release notes of the Clang Static Analyzer for the
llvm-18 release branch, due in about a week.
See the regular [release schedule](https://llvm.org/docs/HowToReleaseLLVM.html#annual-release-schedule).

This patch was written after examining the relevant Static Analyzer
commits since the last release.
Have a look at the commits, and provide feedback if I missed anything
interesting.
Note that the release notes is not meant to be an exhaustive list of the
changes, but rather a curated list of the relevant changes that might
interest our stakeholders, such as tool vendors based on top of CSA or
users with custom checkers.

See the relevant commits by using this command:
```
git log --oneline llvmorg-18-init..llvm/main   clang/{lib/StaticAnalyzer,include/clang/StaticAnalyzer} | grep -v NFC | grep -v -i revert
```
2023-12-28 15:48:59 +01:00
DonatNagyE
c873f77e87
[analyzer] Move alpha checker EnumCastOutOfRange to optin (#67157)
The checker EnumCastOutOfRange verifies the (helpful, but not
standard-mandated) design rule that integer to enum casts should not
produce values that don't have a corresponding enumerator. As it was
improved and cleaned up by recent changes, this commit renames it from
`alpha.cplusplus.EnumCastOutOfRange` to `optin.core.EnumCastOutOfRange`
to reflect that it's no longer alpha quality.

As this checker handles a basic language feature (which is also present
in plain C), I moved it to a "core" subpackage within "optin".

In addition to the renaming, this commit cleans up the documentation in
`checkers.rst` and adds the new example code to a test file to ensure
that it's indeed producing the behavior claimend in the documentation.
2023-12-12 16:29:37 +01:00
Endre Fülöp
b98a594977
[clang][analyzer] Move security.cert.env.InvalidPtr out of alpha (#71912)
Thanks to recent improvements in #67663, InvalidPtr checker does not
emit any false positives on the following OS projects: memcached, tmux,
curl, twin, vim, openssl, sqlite, ffmpeg, postgres, tinyxml2, libwebm,
xerces, bitcoin, protobuf, qtbase, contour, acid, openrct2. (Before the
changes mentioned above, there were 27 reports, catching the `getenv`
invalidates previous `getenv` results cases. That strict behaviour is
disabled by default)
2023-11-24 10:02:56 +01: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
Endre Fülöp
f7a46d700f
[analyzer][clangsa] Add new option to alpha.security.cert.InvalidPtrChecker (#67663)
Introduce 'InvalidatingGetEnv' checker option for 'getenv' calls.

- POSIX suggests consecutive 'getenv' calls may invalidate 
  pointer pointers. This is often too strict in real-world scenarios.
- New 'InvalidatingGetEnv' checker option provides a more 
  pragmatic default that doesn't treat consecutive 'getenv' 
  calls as invalidating.
- Now also handles main function specifications with an 
  environment pointer as the third parameter.

Original Phabricator review:
https://reviews.llvm.org/D154603
2023-10-24 13:59:54 +02: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
Viktor Cseh
0e246bb675 [clang][analyzer] Add C++ array delete checker
This checker reports cases where an array of polymorphic objects are
deleted as their base class. Deleting an array where the array's static
type is different from its dynamic type is undefined.

Since the checker is similar to DeleteWithNonVirtualDtorChecker, I
refactored that checker to support more detection types.

This checker corresponds to the SEI Cert rule EXP51-CPP: Do not delete
an array through a pointer of the incorrect type.

Differential Revision: https://reviews.llvm.org/D158156
2023-10-10 09:37:02 +01:00
Daniel Krupp
97495d3159
[analyzer] TaintPropagation checker strlen() should not propagate (#66086)
strlen(..) call should not propagate taintedness,
because it brings in many false positive findings. It is a common
pattern to copy user provided input to another buffer. In these cases we
always
get warnings about tainted data used as the malloc parameter:

buf = malloc(strlen(tainted_txt) + 1); // false warning

This pattern can lead to a denial of service attack only, when the
attacker can directly specify the size of the allocated area as an
arbitrary large number (e.g. the value is converted from a user provided
string).

Later, we could reintroduce strlen() as a taint propagating function
with the consideration not to emit warnings when the tainted value
cannot be "arbitrarily large" (such as the size of an already allocated
memory block).

The change has been evaluated on the following open source projects:

- memcached: [1 lost false
positive](https://codechecker-demo.eastus.cloudapp.azure.com/Default/reports?run=memcached_1.6.8_ednikru_taint_nostrlen_baseline&newcheck=memcached_1.6.8_ednikru_taint_nostrlen_new&is-unique=on&diff-type=Resolved)

- tmux: 0 lost reports
- twin [3 lost false
positives](https://codechecker-demo.eastus.cloudapp.azure.com/Default/reports?run=twin_v0.8.1_ednikru_taint_nostrlen_baseline&newcheck=twin_v0.8.1_ednikru_taint_nostrlen_new&is-unique=on&diff-type=Resolved)
- vim [1 lost false
positive](https://codechecker-demo.eastus.cloudapp.azure.com/Default/reports?run=vim_v8.2.1920_ednikru_taint_nostrlen_baseline&newcheck=vim_v8.2.1920_ednikru_taint_nostrlen_new&is-unique=on&diff-type=Resolved)
- openssl 0 lost reports
- sqliste [2 lost false
positives](https://codechecker-demo.eastus.cloudapp.azure.com/Default/reports?run=sqlite_version-3.33.0_ednikru_taint_nostrlen_baseline&newcheck=sqlite_version-3.33.0_ednikru_taint_nostrlen_new&is-unique=on&diff-type=Resolved)
- ffmpeg 0 lost repots
- postgresql [3 lost false
positives](https://codechecker-demo.eastus.cloudapp.azure.com/Default/reports?run=postgres_REL_13_0_ednikru_taint_nostrlen_baseline&newcheck=postgres_REL_13_0_ednikru_taint_nostrlen_new&is-unique=on&diff-type=Resolved)
- tinyxml 0 lost reports
- libwebm 0 lost reports
- xerces 0 lost reports

In all cases the lost reports are originating from copying untrusted
environment variables into another buffer.

There are 2 types of lost false positive reports:
1) [Where the warning is emitted at the malloc call by the
TaintPropagation Checker
](https://codechecker-demo.eastus.cloudapp.azure.com/Default/report-detail?run=memcached_1.6.8_ednikru_taint_nostrlen_baseline&newcheck=memcached_1.6.8_ednikru_taint_nostrlen_new&is-unique=on&diff-type=Resolved&report-id=2648506&report-hash=2079221954026f17e1ecb614f5f054db&report-filepath=%2amemcached.c)
`
            len = strlen(portnumber_filename)+4+1;
            temp_portnumber_filename = malloc(len);
`

2) When pointers are set based on the length of the tainted string by
the ArrayOutofBoundsv2 checker.
For example [this
](https://codechecker-demo.eastus.cloudapp.azure.com/Default/report-detail?run=vim_v8.2.1920_ednikru_taint_nostrlen_baseline&newcheck=vim_v8.2.1920_ednikru_taint_nostrlen_new&is-unique=on&diff-type=Resolved&report-id=2649310&report-hash=79dc8522d2cd34ca8e1b2dc2db64b2df&report-filepath=%2aos_unix.c)case.
2023-09-19 11:04:50 +02:00
Kazu Hirata
5dd9568717 Fix typos in documentation 2023-09-02 09:32:48 -07:00
Kazu Hirata
3a14993fa4 Fix typos in documentation 2023-08-27 00:18:14 -07:00
Donát Nagy
25b9696b61 [analyzer] Upstream BitwiseShiftChecker
This commit releases a checker that was developed to a stable level in
the Ericsson-internal fork of Clang Static Analyzer.

Note that the functionality of this checker overlaps with
core.UndefinedBinaryOperatorResult ("UBOR"), but there are several
differences between them:
(1) UBOR is only triggered when the constant folding performed by the
Clang Static Analyzer engine determines that the value of a binary
operator expression is undefined; this checker can report issues where
the operands are not constants.
(2) UBOR has unrelated checks for handling other binary operators, this
checker only examines bitwise shifts.
(3) This checker has a Pedantic flag and by default does not report
expressions (e.g. -2 << 2) that're undefined by the standard but
consistently supported in practice.
(4) UBOR exhibits buggy behavior in code that involves cast expressions,
e.g.
    void foo(unsigned short s) {
      if (s == 2) {
        (void) ((unsigned int) s) << 16;
      }
    }

Later it would be good to eliminate this overlap (perhaps by deprecating
and then eliminating the bitwise shift handling in UBOR), but in my
opinion that belongs to separate commits.

Differential Revision: https://reviews.llvm.org/D156312

Co-authored-by: Endre Fulop <endre.fulop@sigmatechnology.se>
2023-08-18 10:47:05 +02:00
Chris Cotter
32870da3ba Fix typos in documentation 2023-08-13 23:46:44 -07:00
Kazu Hirata
c053345b05 [clang] Fix typos in documentation 2023-08-11 21:44:33 -07:00
Piotr Zegar
a3a66de37f [clang][analyzer][NFC] Change PlacementNewChecker into PlacementNew in documentation
Check name according to Checkers.td is actually a PlacementNew.

Reviewed By: steakhal

Differential Revision: https://reviews.llvm.org/D157702
2023-08-11 16:04:15 +00:00
Daniel Krupp
4dbe2db02d [clang][analyzer] Improved documentation for TaintPropagation Checker
The usage of the taint analysis is described through a command injection attack example.
It is explained how to make a variable sanitized through configuration.

Differential Revision: https://reviews.llvm.org/D145229
2023-07-25 11:34:11 +02:00
Nikolas Klauser
f6d557ee34 [clang][NFC] Remove trailing whitespaces and enforce it in lib, include and docs
A lot of editors remove trailing whitespaces. This patch removes any trailing whitespaces and makes sure that no new ones are added.

Reviewed By: erichkeane, paulkirth, #libc, philnik

Spies: wangpc, aheejin, MaskRay, pcwang-thead, cfe-commits, libcxx-commits, dschuff, nemanjai, arichardson, kbarton, asb, rbar, johnrusso, simoncook, sabuasal, niosHD, jrtc27, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, Jim, s.egerton, sameer.abuasal, apazos, luismarques, martong, frasercrmck, steakhal, luke

Differential Revision: https://reviews.llvm.org/D151963
2023-06-26 09:34:36 -07: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