2 * A script for GCC-dehydra to analyze the Mozilla codebase and catch
3 * patterns that are incorrect, but which cannot be detected by a compiler. */
6 * Activate Treehydra outparams analysis if running in Treehydra.
9 function treehydra_enabled() {
10 return this.hasOwnProperty('TREE_CODE');
13 include('unstable/getopt.js');
14 [options
, args
] = getopt();
16 // XXXbugfix: when you pass arguments to -fplugin-arg, include_path[0] is bad
17 sys
.include_path
[0] = options
.topsrcdir
+ "/xpcom/analysis";
18 sys
.include_path
.push(options
.topsrcdir
);
20 include('string-format.js');
24 function LoadModules(modulelist
)
29 let modulenames
= modulelist
.split(',');
30 for each (let modulename
in modulenames
) {
31 let module
= { __proto__
: this };
32 include(modulename
, module
);
37 LoadModules(options
['dehydra-modules']);
38 if (treehydra_enabled())
39 LoadModules(options
['treehydra-modules']);
41 function process_type(c
)
43 for each (let module
in modules
)
44 if (module
.hasOwnProperty('process_type'))
45 module
.process_type(c
);
48 function hasAttribute(c
, attrname
)
52 if (c
.attributes
=== undefined)
55 for each (attr
in c
.attributes
)
56 if (attr
.name
== 'user' && attr
.value
[0] == attrname
)
61 function process_function(f
, stmts
)
63 for each (let module
in modules
)
64 if (module
.hasOwnProperty('process_function'))
65 module
.process_function(f
, stmts
);
68 function process_tree(fndecl
)
70 for each (let module
in modules
)
71 if (module
.hasOwnProperty('process_tree'))
72 module
.process_tree(fndecl
);
75 function process_decl(decl
)
77 for each (let module
in modules
)
78 if (module
.hasOwnProperty('process_var'))
79 module
.process_decl(decl
);
82 function process_cp_pre_genericize(fndecl
)
84 for each (let module
in modules
)
85 if (module
.hasOwnProperty('process_cp_pre_genericize'))
86 module
.process_cp_pre_genericize(fndecl
);
91 for each (let module
in modules
)
92 if (module
.hasOwnProperty('input_end'))