Summary:
Preparing for the future change, we won't see instructions as lists but as an abstract type.
This change may be a very minor perf regression: does a few more (but bounded by a constant) instructions traversals only for the nodes involving a Printf-like function call, only for the PrintfArgs checker...
Reviewed By: jvillard
Differential Revision: D8094124
fbshipit-source-id: e2e2c5e
Summary:
We never really need the list of nodes/succs/preds, we only need to fold over them.
This will reduce garbage for computed lists like in the Exceptional CFG or the OneInstrPerNode CFG.
Reviewed By: ngorogiannis
Differential Revision: D8185665
fbshipit-source-id: d042beb
Summary:
Users missing the development package for libsqlite3 would see only a failure to install "sqlite3". Adding conf-sqlite3 to the dependencies does not improve things that much but there is a bit more information in the console:
```
[ERROR] The compilation of conf-sqlite3 failed at "pkg-config sqlite3".
[ERROR] The compilation of sqlite3 failed at "jbuilder build -p sqlite3 -j 4".
#=== ERROR while installing conf-sqlite3.1 ====================================#
# opam-version 1.2.2
# os linux
# command pkg-config sqlite3
# path /home/jul/.opam/infer-4.06.1+flambda/build/conf-sqlite3.1
# compiler 4.06.1+flambda
# exit-code 1
# env-file /home/jul/.opam/infer-4.06.1+flambda/build/conf-sqlite3.1/conf-sqlite3-7504-7afd23.env
# stdout-file /home/jul/.opam/infer-4.06.1+flambda/build/conf-sqlite3.1/conf-sqlite3-7504-7afd23.out
# stderr-file /home/jul/.opam/infer-4.06.1+flambda/build/conf-sqlite3.1/conf-sqlite3-7504-7afd23.err
#=== ERROR while installing sqlite3.4.3.2 =====================================#
# opam-version 1.2.2
# os linux
# command jbuilder build -p sqlite3 -j 4
# path /home/jul/.opam/infer-4.06.1+flambda/build/sqlite3.4.3.2
# compiler 4.06.1+flambda
# exit-code 1
# env-file /home/jul/.opam/infer-4.06.1+flambda/build/sqlite3.4.3.2/sqlite3-7504-d2c37b.env
# stdout-file /home/jul/.opam/infer-4.06.1+flambda/build/sqlite3.4.3.2/sqlite3-7504-d2c37b.out
# stderr-file /home/jul/.opam/infer-4.06.1+flambda/build/sqlite3.4.3.2/sqlite3-7504-d2c37b.err
### stderr ###
# -> stdout:
# [...]
# | ast_impl_magic_number: Caml1999M022
# | ast_intf_magic_number: Caml1999N022
# | cmxs_magic_number: Caml1999D022
# | cmt_magic_number: Caml1999T022
# -> stderr:
# Fatal error: exception End_of_file
# Raised at file "src/import0.ml" (inlined), line 351, characters 22-32
# Called from file "src/configurator.ml", line 511, characters 13-22
# Called from file "src/config/discover.ml", line 42, characters 2-1023
Exception:
Reqs_error
(Process_error
("opam install -y ANSITerminal.0.8 atd.1.12.0 atdgen.1.12.0 base.v0.11.0 base64.2.2.0 bin_prot.v0.11.0 biniou.1.2.0 camlp4.4.06+1 camlzip.1.07 cmdliner.1.0.2 conf-aclocal.1.0.0 conf-autoconf.0.1 conf-m4.1 conf-pkg-config.1.0 conf-sqlite3.1 conf-which.1 conf-zlib.1 configurator.v0.11.0 core.v0.11.0 "... (* string length 1469; truncated *),
Unix.WEXITED 4)).
```
Also fix some issues with `build-infer.sh`:
- fix a problem where `SCRIPT_PATH` should be `SCRIPT_DIR`
- add `set -u` and `set -o pipefail` to make sure we don't miss errors in the future
- add quotes everywhere
- make number of `JOBS` user-configurable instead of hardcoding `$NCPU`
Reviewed By: mbouaziz
Differential Revision: D8201849
fbshipit-source-id: 19b7c77
Summary: In preparation to change the underlying module structure so as to allow three-point traces (call-site, intermediate call-site and endpoint), rename modules to better reflect function plus use records vs pairs of pairs :P
Reviewed By: mbouaziz
Differential Revision: D8187369
fbshipit-source-id: ed3e4ac
Summary:
There can be multiple reports per line, especially when calling in a method which has itself multiple reports.
When reporting at the callsite, report only the issue with the highest severity (picked manually per type of event).
Deadlocks are not de-duplicated, as they are relatively rare and the info in mupltiple reports may be important.
Reviewed By: mbouaziz
Differential Revision: D8160940
fbshipit-source-id: ea6a5c0
Summary:
The main motivation is preparing for a future change.
This also reduces lifetime of potential garbage.
Reviewed By: jeremydubreil
Differential Revision: D8185648
fbshipit-source-id: 6d0a568
Summary:
Append can be costly, let's do it once only.
Depends on D8185619
Reviewed By: jeremydubreil
Differential Revision: D8185634
fbshipit-source-id: 67f84a9
Summary:
Rely on the underlying CFG preds:
- perf: no need to append lists
- correctness: the underlying CFG may be removing duplicates
Reviewed By: ngorogiannis
Differential Revision: D8185638
fbshipit-source-id: 3b6f70a
Summary:
- do not `List.rev` for `List.last`
- `List.rev_filter_map` rather than `filter |> map |> rev`
Reviewed By: da319
Differential Revision: D8185619
fbshipit-source-id: aeb41a4
Summary: The order of nodes means nothing, and should not matter, let's save the whales!
Reviewed By: ngorogiannis
Differential Revision: D8182137
fbshipit-source-id: bc14a2c
Summary:
Moving away from C++ include-based models means that we cannot reliably detect
anymore whether a file includes <iostream> or not. In order not to be too
spammy, let's always assume standard streams are initialized for now when the
include models are off.
Recent versions of libstdc++ make these models redundant so there is hope that in a
bright future the analysis of std streams initialisation will work correctly without infer
having to have its own models anyway.
Reviewed By: mbouaziz
Differential Revision: D8043467
fbshipit-source-id: d118043
Summary: Prevent the analysis to default to absolute paths which would invalidate the cache.
Reviewed By: mbouaziz
Differential Revision: D6997490
fbshipit-source-id: 3c17658
Summary: We want both pointer and pointer dereference to be uninitialised at the beginning. Forgot to add the expression of type pointer when updating the analysis from access paths to access expressions.
Reviewed By: ddino
Differential Revision: D8117011
fbshipit-source-id: 534f7ef
Summary: Set arguments of pointer type as initialised for indirect function calls.
Reviewed By: mbouaziz
Differential Revision: D8097895
fbshipit-source-id: 830f568
Summary: Track and surface the reasons why a method is assessed to run on the UI thread.
Reviewed By: mbouaziz
Differential Revision: D8096099
fbshipit-source-id: 2403c6c
Summary:
The reported location was always the start of the enclosing procedure, which is wrong in many ways.
A nice side-effect is that some code can then be eliminated and Ondemand.analyze used, avoiding getting the procdescs in the process.
Reviewed By: jeremydubreil
Differential Revision: D8056306
fbshipit-source-id: 67c2c8d
Summary: Treat array accesses as initialised if they are passed by reference.
Reviewed By: jvillard
Differential Revision: D8071247
fbshipit-source-id: 5480e90
Summary: The type of array element is not preserved correctly in the translation from SIL to HIL. When array element is passed by a reference, i.e. `f(&(array[0]))`, the type of array element gets the type of a pointer of array element.
Reviewed By: jvillard
Differential Revision: D8071188
fbshipit-source-id: 3e6635e
Summary:
The deadcode checker is poorly written and as a result is more useful than
intended!
Reviewed By: mbouaziz
Differential Revision: D8088654
fbshipit-source-id: 19a94b8