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 sys.include_path.push(options.topsrcdir);
18 include('string-format.js');
22 function LoadModules(modulelist)
27 let modulenames = modulelist.split(',');
28 for each (let modulename in modulenames) {
29 let module = { __proto__: this };
30 include(modulename, module);
35 LoadModules(options['dehydra-modules']);
36 if (treehydra_enabled())
37 LoadModules(options['treehydra-modules']);
39 function process_type(c)
41 for each (let module in modules)
42 if (module.hasOwnProperty('process_type'))
43 module.process_type(c);
46 function hasAttribute(c, attrname)
50 if (c.attributes === undefined)
53 for each (attr in c.attributes)
54 if (attr.name == 'user' && attr.value[0] == attrname)
59 function process_function(f, stmts)
61 for each (let module in modules)
62 if (module.hasOwnProperty('process_function'))
63 module.process_function(f, stmts);
66 function process_tree(fndecl)
68 for each (let module in modules)
69 if (module.hasOwnProperty('process_tree'))
70 module.process_tree(fndecl);
73 function process_decl(decl)
75 for each (let module in modules)
76 if (module.hasOwnProperty('process_decl'))
77 module.process_decl(decl);
80 function process_cp_pre_genericize(fndecl)
82 for each (let module in modules)
83 if (module.hasOwnProperty('process_cp_pre_genericize'))
84 module.process_cp_pre_genericize(fndecl);
89 for each (let module in modules)
90 if (module.hasOwnProperty('input_end'))