Bug 400795 - initial form fill and username autocomplete should share common code...
[wine-gecko.git] / xpcom / analysis / static-checking.js
blobd8256710c30fff1ab4822106c43e2193db5cf1bc
1 /**
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. */
5 /**
6 * Activate Treehydra outparams analysis if running in Treehydra.
7 */
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');
22 let modules = [];
24 function LoadModules(modulelist)
26 if (modulelist == "")
27 return;
29 let modulenames = modulelist.split(',');
30 for each (let modulename in modulenames) {
31 let module = { __proto__: this };
32 include(modulename, module);
33 modules.push(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)
50 var attr;
52 if (c.attributes === undefined)
53 return false;
55 for each (attr in c.attributes)
56 if (attr.name == 'user' && attr.value[0] == attrname)
57 return true;
59 return false;
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);
89 function input_end()
91 for each (let module in modules)
92 if (module.hasOwnProperty('input_end'))
93 module.input_end();