[erlang-questions] xref doesn't show all the calls

Matthias Lang matthias@REDACTED
Fri Sep 2 23:05:28 CEST 2016


On 02. September 2016, Gonchar Denis wrote:

> I noticed that *xref* doesn't detect some of the calls.
...
> lists:reverse([]),
> lists:keyfind(a,1,[]).
...
> *4>* xref:q(s, "E | test:Mod").
> {ok,[{{test,test,0},{lists,reverse,1}}]}
...
> can anyone explain why *xref* doesn't detect* lists:keyfind/3* call?

Clue:

2> erlang:is_builtin(lists, keyfind, 3).
true
3> erlang:is_builtin(lists, reverse, 1).
false

use the 'builtins' option in xref.

---

Erlang/OTP 18 [erts-7.3] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V7.3  (abort with ^G)
1> c(test,[debug_info]).
{ok,test}
2> xref:start(s).
{ok,<0.41.0>}
3> xref:add_directory(s,".", [builtins]).
{error,xref_base,{invalid_options,[builtins]}}
4> xref:add_directory(s,".", [{builtins, true}]).
Skipping ./a.beam (no debug information)
{ok,[test]}
5> xref:q(s, "E | test:Mod").
{ok,[{{test,test,0},{lists,keyfind,3}},
     {{test,test,0},{lists,reverse,1}}]}


Matt



More information about the erlang-questions mailing list