14 Commits

Author SHA1 Message Date
Ryosuke Niwa
031f9f3317
[alpha.webkit.UncountedCallArgsChecker] Ignore calls to WTF's container methods (#82156)
This PR makes the checker ignore / skip calls to methods of Web Template
Platform's container types such as HashMap, HashSet, WeakHashSet,
WeakHashMap, Vector, etc...
2024-02-20 17:12:24 -08:00
Ryosuke Niwa
c3b87a8810
[alpha.webkit.UncountedCallArgsChecker] Allow ASSERT and atomic<T> operations in a trivial function (#82063) 2024-02-19 16:11:49 -08:00
Ryosuke Niwa
a7982d5e7a
[analyzer] UncountedCallArgsChecker: Detect & ignore trivial function calls. (#81808)
This PR introduces the concept of a "trivial function" which applies to
a function that only calls other trivial functions and contain literals
and expressions that don't result in heap mutations (specifically it
does not call deref). This is implemented using ConstStmtVisitor and
checking each statement and expression's trivialness.

This PR also introduces the concept of a "ingleton function", which is a
static member function or a free standing function which ends with the
suffix "singleton". Such a function's return value is understood to be
safe to call any function with.
2024-02-14 18:46:30 -08:00
Ryosuke Niwa
cbdc7605ed
[analyzer] Add a few more safe functions to call. (#81532)
Added checkedDowncast, uncheckedDowncast, & toString as safe functions
to call in alpha.webkit.UncountedCallArgsChecker.
2024-02-14 14:45:29 -08:00
Ryosuke Niwa
3a49dfb28f
[analyzer] Check the safety of the object argument in a member function call. (#81400)
This PR makes alpha.webkit.UncountedCallArgsChecker eplicitly check the
safety of the object argument in a member function call. It also removes
the exemption of local variables from this checker so that each local
variable's safety is checked if it's used in a function call instead of
relying on the local variable checker to find those since local variable
checker currently has exemption for "for" and "if" statements.
2024-02-14 14:44:51 -08:00
Ryosuke Niwa
2dbfa8407e
[analyzer] Allow default arguments to be evaluated like other arguments. (#80956)
This PR aligns the evaluation of default arguments with other kinds of
arguments by extracting the expressions within them as argument values
to be evaluated.
2024-02-12 15:01:40 -08:00
Ryosuke Niwa
85507f17cf
[analyzer] Ignore assignment to Ref / RefPtr in alpha.webkit.UncountedCallArgsChecker. (#80810) 2024-02-12 14:59:14 -08:00
Kazu Hirata
651c502fc8 [clang] Stop including llvm/ADT/DenseSet.h (NFC)
Identified with clangd.
2023-11-11 22:25:48 -08:00
Ryosuke Niwa
5070c1e3b0 [analyzer] WebKit checkers: recognize dynamicDowncast as a safe function.
It can take raw pointers without triggering a warning.

Also retire the support for makeRef and makeWeakPtr as they have been removed
from WebKit.
2023-10-19 16:10:57 -07:00
Kazu Hirata
6ad0788c33 [clang] Use std::optional instead of llvm::Optional (NFC)
This patch replaces (llvm::|)Optional< with std::optional<.  I'll post
a separate patch to remove #include "llvm/ADT/Optional.h".

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2023-01-14 12:31:01 -08:00
Kazu Hirata
a1580d7b59 [clang] Add #include <optional> (NFC)
This patch adds #include <optional> to those files containing
llvm::Optional<...> or Optional<...>.

I'll post a separate patch to actually replace llvm::Optional with
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2023-01-14 11:07:21 -08:00
Kazu Hirata
d0ac215dd5 [clang] Use isa instead of dyn_cast (NFC) 2021-11-14 09:32:40 -08:00
Jan Korous
47e6851423 [Analyzer][WebKit] Use tri-state types for relevant predicates
Some of the predicates can't always be decided - for example when a type
definition isn't available. At the same time it's necessary to let
client code decide what to do about such cases - specifically we can't
just use true or false values as there are callees with
conflicting strategies how to handle this.

This is a speculative fix for PR47276.

Differential Revision: https://reviews.llvm.org/D88133
2020-09-22 21:57:24 -07:00
Jan Korous
a7eb3692e7 [Analyzer][WebKit] UncountedCallArgsChecker
Differential Revision: https://reviews.llvm.org/D77179
2020-06-15 13:53:36 -07:00