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
master
parent
1d98d3cd58
commit
dc2cd65a2c
Loading…
Reference in new issue