Summary:
On wrong arguments (or on no arguments at all), `infer` would spew the error
message of `infer.py`, which makes no sense. Make the python code swallow error
messages and exit with a special code on errors coming from command line
parsing so that the OCaml side is in charge of printing usage messages.
Reviewed By: cristianoc
Differential Revision: D3731594
fbshipit-source-id: fe49cda
Summary:
Adding a new mode linters. Now if the analyzer is linters, we do the linters and don't translate,
then, if the analyzer is Infer, we do the translation and the backend and not the linters checks, and the
default is that we do capture, backend and lint checks.
Made the tests separated, which saves time and also shows that the linters mode works.
Reviewed By: jvillard
Differential Revision: D3723472
fbshipit-source-id: 9d828d8
Summary:
Since clang -### can silently return nothing when passed bogus arguments (eg,
trying to compile a non-existent file), run the original command in that case
in case it's a genuine error. This prevents puzzling behaviours such as
`infer -- clang -c bogus_file.c` succeeding with 0 files analyzed.
Reviewed By: martinoluca
Differential Revision: D3592924
fbshipit-source-id: 5d8bc81
Summary: Emit a simple info message on terminal whenever aggregation of stats fails for whatever reason, details about the failure will still be available in `toplevel.log`
Reviewed By: jvillard
Differential Revision: D3516339
fbshipit-source-id: fe24d64
Summary:
This diff changes the toplevel 'infer' executable from the current
python script to an OCaml binary. Currently this executable only parses
command line arguments, sets up environment variables, and invokes the
existing python script. This improves infer's command-line and
configuration interface, since passing arguments to the frontends or
backend no longer requires manually setting environment variables, and
arguments for the toplevel can now also be specified in .inferconfig.
Simplification and migration of functionality from the python script is
left for the future.
Reviewed By: martinoluca, jvillard
Differential Revision: D3450662
fbshipit-source-id: 1b52302
Summary: Infer should be responsible for ensuring that `-j` is respected.
Reviewed By: jberdine
Differential Revision: D3450064
fbshipit-source-id: 5286a6a
Summary:
Use the output of `clang -###` to drive which commands to run. Attach the plugin to all commands starting with `-cc1`.
Benefits:
- support for compiling multiple files in one clang command, eg `infer -- clang -c file1.c file2.c`
- support for compile commands that do not target a `.o` file, eg `infer -- clang -S hello.c`
- support for `-cc1` compile commands
- more generally, run all commands that clang would run, and attach plugin in all compilation cases
Reviewed By: martinoluca
Differential Revision: D3366912
fbshipit-source-id: 98d5e3b
Summary:
buck #infer flavor doesn't rely on .o files so we don't need to generate them.
It will save memory/IO and possibly time
Reviewed By: jvillard, martinoluca
Differential Revision: D3379463
fbshipit-source-id: 1d48f7a
Summary:
Run `InferStatsAggregator` at the end of the execution of `infer` top-level, and store
results on `infer-out/(frontend|backend|reporting)_stats/aggregated_stats.json`
Not ready yet for buck targets analyzed without the use of an `#infer*` flavor.
Reviewed By: jvillard
Differential Revision: D3365504
fbshipit-source-id: 98b2eb3
Summary: It is preferable to always create error reports as a proof of succesful termination, even when the Buck target contains no source file to analyze
Reviewed By: sblackshear, jvillard
Differential Revision: D3362581
fbshipit-source-id: 4f27666
Summary:
When syntax highlighting the source excerpts that Infer prints on stdout, we
would crash if `pygments.lexers` did not find a suitable class given the name
of the source file. Instead, do not colorize when that's the case.
Reviewed By: martinoluca
Differential Revision: D3358115
fbshipit-source-id: ccb9b41
Summary:
Make analyzer find out when null dereference comes from std::vector method.
If it does, it means that it's really empty vector access (due to the
way infer models std::vector)
Reviewed By: sblackshear
Differential Revision: D3327933
fbshipit-source-id: b9e11d6
Summary: This way we don't need to make the file be valid json later on.
Reviewed By: jeremydubreil
Differential Revision: D3304998
fbshipit-source-id: 25deb5c
Summary:
The checkers check was causing perf issues because it kept loading the json of
inferconfig. To prevent this from happening again, load json files inside
config.ml, and only export `Yojson.Basic.json Lazy.t` values to other modules.
Also move the list of checks disabled by default into config.ml for better
discoverability.
Reviewed By: jberdine
Differential Revision: D3293041
fbshipit-source-id: 4a38b26
Summary:
Infer prepends the directory containing the ananotation processor and
the current working directory to the classpath javac option. This diff
enables prepending these to the classpath when it is passing in an args
file (as the classpath can get too long to pass on the command line).
Reviewed By: jvillard
Differential Revision: D3270348
fbshipit-source-id: 208077f
Summary:
- [python] decode strings coming from `os.*` commands
- [python] decode strings coming from the command-line
- [python] encode a few remaining unicodes into strings
- [java] replace lex/yacc parser for javac verbose output by regex-based matching to handle unicode in paths
- [make] random fix of `make test` to have `make clean test` work
- [integration tests] add e2e build integration tests for utf8 in the PWD
Closes#76
Reviewed By: martinoluca
Differential Revision: D3240809
fb-gh-sync-id: 8c2e1ed
fbshipit-source-id: 8c2e1ed
Summary: Provide possibility to replace clang internal headers path if they are overwritten by `-isystem`. User needs to specify path to wrong headers to be replaced with infer's clang.
Reviewed By: martinoluca
Differential Revision: D3212850
fb-gh-sync-id: be3d51c
fbshipit-source-id: be3d51c
Summary:Open-source clang has caught up a bit with apple's clang, so we don't need to
filter as many compilation flags as we used to.
Reviewed By: akotulski, martinoluca
Differential Revision: D3212553
fb-gh-sync-id: 5638dc8
fbshipit-source-id: 5638dc8
Summary:This enables controlling the encoding chosen by infer via the usual environment
variables. For instance:
```
LC_ALL="C" infer ... # sets LOCALE to "ascii"
LC_ALL="en_US.UTF-8" infer ... # sets LOCALE to "UTF-8"
```
This gives an easy solution to #320: run `LC_ALL="en_US.UTF-8" infer ...`.
Right now the only solution is to edit the Python scripts by hand instead!
Reviewed By: jberdine
Differential Revision: D3207573
fb-gh-sync-id: 62d5b98
fbshipit-source-id: 62d5b98
Summary:`exc.output` can be (always is?) `None`. Other places in the code only print
using `traceback.print_exc()` and this was the only place trying to print this
extra info (`git grep CalledProcessError`). This caused `utils.stdout()` to
raise an exception, which was further confusing.
closes#330
Reviewed By: jberdine
Differential Revision: D3203896
fb-gh-sync-id: d2988d8
fbshipit-source-id: d2988d8
Summary:It turns out, apple clang turns off cxx-modules under the hood. Open source clang doesn't do it by default
and we need to do it ourselves.
Reviewed By: jvillard, martinoluca
Differential Revision: D3201604
fb-gh-sync-id: 82cea0f
fbshipit-source-id: 82cea0f
Summary:public
Remove option to filter source files from being analysed from clang wrapper.
The option is unused and there should be better mechanism to do so if we need it.
This will slightly simplify the script and allow to analyze files that are from
outside of "blessed" extensions (such as .cxx or .hpp)
Reviewed By: dulmarod
Differential Revision: D3126330
fb-gh-sync-id: 1628913
fbshipit-source-id: 1628913
Summary:public
In order to make infer more resiliant to compilation failure,
make static_assert to do nothing.
As a bonus, set _FORTIFY_SOURCE inside same file instead of command line
Reviewed By: jvillard
Differential Revision: D3133446
fb-gh-sync-id: 590f4ad
fbshipit-source-id: 590f4ad
Summary:public
Models in headers are purely C++ concept and it's
useless if C++ mode is turned off. Since those
models can lead to compilation errors, turn them
off for non-C++ analysis
Reviewed By: martinoluca
Differential Revision: D3126294
fb-gh-sync-id: 0912e7b
fbshipit-source-id: 0912e7b
Summary:public
Simplifies the way to configure cmake to run infer's fake compiler commands.
Instead of `CC=/path/to/infer/infer/lib/capture/clang cmake .`, which is what
is advised on #25 and is now outdated because the paths to infer's clang has
changed since, simply run `infer -- cmake .`. The only caveat is that infer
tries to analyze the end result, and prints "No issues found". This could be
fixed later.
Reviewed By: jeremydubreil
Differential Revision: D3093162
fb-gh-sync-id: 99df50a
fbshipit-source-id: 99df50a