~clint-fewbar/ubuntu/precise/erlang/merge-15b

« back to all changes in this revision

Viewing changes to lib/dialyzer/src/dialyzer_callgraph.hrl

  • Committer: Elliot Murphy
  • Date: 2009-12-22 02:56:21 UTC
  • mfrom: (3.3.5 sid)
  • Revision ID: elliot@elliotmurphy.com-20091222025621-qv3rja8gbpiabkbe
Tags: 1:13.b.3-dfsg-2ubuntu1
* Merge with Debian testing; remaining Ubuntu changes:
  - Drop libwxgtk2.8-dev build dependency. Wx isn't in main, and not
    supposed to. (LP #438365)
  - Drop erlang-wx binary.
  - Drop erlang-wx dependency from -megaco, -common-test, and -reltool, they
    do not really need wx. Also drop it from -debugger; the GUI needs wx,
    but it apparently has CLI bits as well, and is also needed by -megaco,
    so let's keep the package for now.
* Fixed dialyzer(1) manpage which was placed into section 3 and conflicted
  with dialyzer(3erl).
* New upstream release (it adds a new binary package erlang-erl-docgen).
* Refreshed patches, removed most of emacs.patch which is applied upstream.
* Linked run_test binary from erlang-common-test package to /usr/bin.
* Fixed VCS headers in debian/control.
* Moved from prebuilt manpages to generated from sources. This adds
  erlang-manpages binary package and xsltproc build dependency.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
%% -*- erlang-indent-level: 2 -*-
2
 
%%--------------------------------------------------------------------
3
 
%% %CopyrightBegin%
4
 
%% 
5
 
%% Copyright Ericsson AB 2007-2009. All Rights Reserved.
6
 
%% 
7
 
%% The contents of this file are subject to the Erlang Public License,
8
 
%% Version 1.1, (the "License"); you may not use this file except in
9
 
%% compliance with the License. You should have received a copy of the
10
 
%% Erlang Public License along with this software. If not, it can be
11
 
%% retrieved online at http://www.erlang.org/.
12
 
%% 
13
 
%% Software distributed under the License is distributed on an "AS IS"
14
 
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15
 
%% the License for the specific language governing rights and limitations
16
 
%% under the License.
17
 
%% 
18
 
%% %CopyrightEnd%
19
 
%%
20
 
 
21
 
%%-----------------------------------------------------------------------------
22
 
%% File    : dialyzer_callgraph.hrl
23
 
%% Author  : Tobias Lindahl <tobiasl@it.uu.se>
24
 
%%           Kostis Sagonas <kostis@it.uu.se>
25
 
%% Description : Header file for Dialyzer's call graph module.
26
 
%%
27
 
%% Created : 23 Nov 2007 by Kostis Sagonas <kostis@it.uu.se>
28
 
%%-----------------------------------------------------------------------------
29
 
 
30
 
%%-----------------------------------------------------------------------------
31
 
%% A callgraph is a directed graph where the nodes are functions and a
32
 
%% call between two functions is an edge from the caller to the callee.
33
 
%% 
34
 
%% calls        -  A mapping from call site (and apply site) labels
35
 
%%                 to the possible functions that can be called.
36
 
%% digraph      -  A digraph representing the callgraph. 
37
 
%%                 Nodes are represented as MFAs or labels.
38
 
%% esc          -  A set of all escaping functions as reported by dialyzer_dep.
39
 
%% postorder    -  A list of strongly connected components of the callgraph
40
 
%%                 sorted in a topological bottom-up order.
41
 
%%                 This is produced by calling finalize/1.
42
 
%% name_map     -  A mapping from label to MFA.
43
 
%% rev_name_map -  A reverse mapping of the name_map.
44
 
%% rec_var_map  -  A dict mapping from letrec bound labels to function names.
45
 
%%                 Only for top level functions (from module defs).
46
 
%% self_rec     -  A set containing all self recursive functions.
47
 
%%                 Note that this contains MFAs for named functions and labels
48
 
%%                 whenever applicable.
49
 
%%-----------------------------------------------------------------------------
50
 
 
51
 
%%-----------------------------------------------------------------------
52
 
 
53
 
-define(no_arg, no_arg).
54
 
-define(no_label, no_label).
55
 
 
56
 
%%-----------------------------------------------------------------------
57
 
 
58
 
-type mfa_or_funlbl() :: label() | mfa().
59
 
-type scc()           :: [mfa_or_funlbl()].
60
 
-type mfa_calls()     :: [{mfa_or_funlbl(), mfa_or_funlbl()}].
61
 
 
62
 
%%-----------------------------------------------------------------------
63
 
 
64
 
%%-----------------------------------------------------------------------
65
 
%% Basic types used in the race analysis
66
 
%%-----------------------------------------------------------------------
67
 
 
68
 
-type label_type() :: label() | [label()] | {label()} | ?no_label.
69
 
-type args()       :: 'empty' | [label_type() | [string()]].
70
 
-type core_vars()  :: core_tree() | ?no_arg.
71
 
-type var_to_map() :: core_vars() | [core_tree()].
72
 
-type dep_calls()  :: 'whereis' | 'ets_lookup' | 'mnesia_dirty_read'.
73
 
-type warn_calls() :: 'register' | 'ets_insert' | 'mnesia_dirty_write'.
74
 
-type race_tag()   :: 'whereis_register' | 'ets_lookup_insert'
75
 
                    | 'mnesia_dirty_read_write'.
76
 
 
77
 
-record(beg_clause, {arg        :: var_to_map(),
78
 
                     pats       :: var_to_map(),
79
 
                     guard      :: core_tree()}).
80
 
-record(end_clause, {arg        :: var_to_map(),
81
 
                     pats       :: var_to_map(),
82
 
                     guard      :: core_tree()}).
83
 
-record(end_case,   {clauses    :: [#end_clause{}]}).
84
 
-record(curr_fun,   {status     :: 'in' | 'out',
85
 
                     mfa        :: mfa_or_funlbl(),
86
 
                     label      :: label(),
87
 
                     def_vars   :: [core_vars()],
88
 
                     arg_types  :: [erl_types:erl_type()],
89
 
                     call_vars  :: [core_vars()],
90
 
                     var_map    :: dict()}).
91
 
-record(dep_call,   {call_name  :: dep_calls(),
92
 
                     args       :: args(),
93
 
                     arg_types  :: [erl_types:erl_type()],
94
 
                     vars       :: [core_vars()],
95
 
                     state      :: _,
96
 
                     file_line  :: file_line(),
97
 
                     var_map    :: dict()}).
98
 
-record(fun_call,   {caller     :: mfa_or_funlbl(),
99
 
                     callee     :: mfa_or_funlbl(),
100
 
                     arg_types  :: [erl_types:erl_type()],
101
 
                     vars       :: [core_vars()]}).
102
 
-record(let_tag,    {var        :: var_to_map(),
103
 
                     arg        :: var_to_map()}).
104
 
-record(warn_call,  {call_name  :: warn_calls(),
105
 
                     args       :: args(),
106
 
                     var_map    :: dict()}).
107
 
 
108
 
-type case_tags()  :: 'beg_case' | #beg_clause{} | #end_clause{} | #end_case{}.
109
 
-type code()       :: [#dep_call{} | #warn_call{} | #fun_call{} |
110
 
                       #curr_fun{} | #let_tag{} | case_tags() | race_tag()]
111
 
                    | 'empty'.
112
 
 
113
 
%%----------------------------------------------------------------------
114
 
%% Record declarations used in various files
115
 
%%----------------------------------------------------------------------
116
 
 
117
 
-record(dialyzer_callgraph, {digraph        = digraph:new() :: digraph(),
118
 
                             esc            = sets:new()    :: set(),
119
 
                             name_map       = dict:new()    :: dict(),
120
 
                             rev_name_map   = dict:new()    :: dict(),
121
 
                             postorder      = []            :: [scc()],
122
 
                             rec_var_map    = dict:new()    :: dict(),
123
 
                             self_rec       = sets:new()    :: set(),
124
 
                             calls          = dict:new()    :: dict(),
125
 
                             race_code      = dict:new()    :: dict(),
126
 
                             public_tables  = []            :: [label()],
127
 
                             named_tables   = []            :: [string()],
128
 
                             race_detection = false         :: boolean()}).