Jules Villard
dc2cd65a2c
[explore] print only non-default values in the attributes
...
Summary:
Attributes have lots of fields, but the majority is usually the same from one procedure to the other.
This attempts to print only non-default values, where the default is the
"empty" attributes (as opposed to the "most commonly seen value" for each
field), in an attempt to be predictible. This is largely something that should
be done with a ppx but since there's only one use case it didn't seem worth the
trouble.
Output of `infer explore --procedures --procedures-attributes --procedures-name` before:
```
test: examples/hello.c test <defined>
{access= <Default>; captured= []; did_preanalysis= false; err_log= [
]; exceptions= []; formals= []; const_formals= []; by_vals= [];
func_attributes= []; is_abstract= false; is_bridge_method= false;
is_defined= true; is_cpp_noexcept_method= false;
is_java_synchronized_method= false; is_model= false;
is_specialized= false; is_synthetic_method= false;
clang_method_kind= C_FUNCTION; loc= line 12, column 1;
translation_unit= Some examples/hello.c;
locals= [{name= s;typ= ;attributes= }]; method_annotation= <> ();
objc_accessor= None; proc_flags= []; proc_name= test; ret_type= ;
source_file_captured=examples/hello.c}
int Hello.test(): examples/Hello.java int Hello.test() <defined>
{access= <Default>; captured= []; did_preanalysis= false; err_log= [
]; exceptions= []; formals= [(this,)]; const_formals= []; by_vals= [
]; func_attributes= []; is_abstract= false; is_bridge_method= false;
is_defined= true; is_cpp_noexcept_method= false;
is_java_synchronized_method= false; is_model= false;
is_specialized= false; is_synthetic_method= false;
clang_method_kind= C_FUNCTION; loc= line 11; translation_unit= None;
locals= [{name= $irvar0;typ= ;attributes= }; {name= s;typ= ;attributes= }];
method_annotation= <> (); objc_accessor= None; proc_flags= [];
proc_name= int Hello.test(); ret_type= ;
source_file_captured=examples/Hello.java}
Hello.<init>(): examples/Hello.java Hello.<init>() <defined>
{access= <Default>; captured= []; did_preanalysis= false; err_log= [
]; exceptions= []; formals= [(this,)]; const_formals= []; by_vals= [
]; func_attributes= []; is_abstract= false; is_bridge_method= false;
is_defined= true; is_cpp_noexcept_method= false;
is_java_synchronized_method= false; is_model= false;
is_specialized= false; is_synthetic_method= false;
clang_method_kind= C_FUNCTION; loc= line 10; translation_unit= None;
locals= []; method_annotation= <> (); objc_accessor= None;
proc_flags= []; proc_name= Hello.<init>(); ret_type= ;
source_file_captured=examples/Hello.java}
```
Now:
```
test
source_file: examples/hello.c
proc_name: test
attribute_kind: <defined>
attributes:
{ proc_name= test
; source_file_captured= examples/hello.c
; formals= []
; is_defined= true
; loc= line 12, column 1
; translation_unit= <Some examples/hello.c>
; locals= [{ name= s; typ= int* }]
; ret_type= void }
int Hello.test()
source_file: examples/Hello.java
proc_name: int Hello.test()
attribute_kind: <defined>
attributes:
{ proc_name= int Hello.test()
; source_file_captured= examples/Hello.java
; formals= [(this,Hello*)]
; is_defined= true
; loc= line 11
; locals= [{ name= $irvar0; typ= void };
{ name= s; typ= java.lang.String* }]
; ret_type= int }
Hello.<init>()
source_file: examples/Hello.java
proc_name: Hello.<init>()
attribute_kind: <defined>
attributes:
{ proc_name= Hello.<init>()
; source_file_captured= examples/Hello.java
; formals= [(this,Hello*)]
; is_defined= true
; loc= line 10
; ret_type= void }
```
Reviewed By: mbouaziz
Differential Revision: D7757890
fbshipit-source-id: 5507ec6
7 years ago
Jules Villard
705a2f97b2
[sqlite] use pname BLOB as the sqlite key, include readable pname for debug
...
Summary:
We were using the "filename" as the key because it's (kinda) unique *and* human
readable, but with the `infer explore --procedures` interface we don't really
need the human readable part anymore, so we can just use the OCaml marshalling
of the pname as the key. The human-readable version (sans unique-fying hash) is
now another column in the table, used to match procedure names in
`--procedures-filter`.
Reviewed By: sblackshear
Differential Revision: D7639158
fbshipit-source-id: e714605
7 years ago
Jules Villard
97ac7662f8
[sqlite] options to output procedures db
...
Summary:
Add a `--procedures` option to `infer explore` to print information about the
procedures captured by infer. More precisely, `infer explore --procedures` will
print each row of the "procedures" table in the results database. A new
`--procedures-filter` controls which procedures to print information about, and
there is one flag per column in the db too to print more or less options about
each procedure (in particular, we can now print attributes), with some defaults.
Reviewed By: sblackshear
Differential Revision: D7639062
fbshipit-source-id: 034a2b8
7 years ago