diff options
author | Alon Zakai <azakai@google.com> | 2019-04-26 16:59:41 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-26 16:59:41 -0700 |
commit | db9124f1de0478dcac525009b6f1589b44a7edd8 (patch) | |
tree | fa26395a0f6cca53cf5cb6e10189f989c5bfa847 /src/tools/js-wrapper.h | |
parent | 87636dccd404a340d75acb1d96301581343f29ca (diff) | |
download | binaryen-db9124f1de0478dcac525009b6f1589b44a7edd8.tar.gz binaryen-db9124f1de0478dcac525009b6f1589b44a7edd8.tar.bz2 binaryen-db9124f1de0478dcac525009b6f1589b44a7edd8.zip |
Apply format changes from #2048 (#2059)
Mass change to apply clang-format to everything. We are applying this in a PR by me so the (git) blame is all mine ;) but @aheejin did all the work to get clang-format set up and all the manual work to tidy up some things to make the output nicer in #2048
Diffstat (limited to 'src/tools/js-wrapper.h')
-rw-r--r-- | src/tools/js-wrapper.h | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/src/tools/js-wrapper.h b/src/tools/js-wrapper.h index 433d6fc5a..e39a015d6 100644 --- a/src/tools/js-wrapper.h +++ b/src/tools/js-wrapper.h @@ -28,7 +28,8 @@ static std::string generateJSWrapper(Module& wasm) { "}\n" "var tempRet0;\n" "var binary;\n" - "if (typeof process === 'object' && typeof require === 'function' /* node.js detection */) {\n" + "if (typeof process === 'object' && typeof require === 'function' /* " + "node.js detection */) {\n" " var args = process.argv.slice(2);\n" " binary = require('fs').readFileSync(args[0]);\n" " if (!binary.buffer) binary = new Uint8Array(binary);\n" @@ -59,12 +60,21 @@ static std::string generateJSWrapper(Module& wasm) { " }\n" " return ret;\n" "}\n" - "var instance = new WebAssembly.Instance(new WebAssembly.Module(binary), {\n" + "var instance = new WebAssembly.Instance(new " + "WebAssembly.Module(binary), {\n" " 'fuzzing-support': {\n" - " 'log-i32': function(x) { console.log('[LoggingExternalInterface logging ' + literal(x, 'i32') + ']') },\n" - " 'log-i64': function(x, y) { console.log('[LoggingExternalInterface logging ' + literal(x, 'i32') + ' ' + literal(y, 'i32') + ']') },\n" // legalization: two i32s - " 'log-f32': function(x) { console.log('[LoggingExternalInterface logging ' + literal(x, 'f64') + ']') },\n" // legalization: an f64 - " 'log-f64': function(x) { console.log('[LoggingExternalInterface logging ' + literal(x, 'f64') + ']') },\n" + " 'log-i32': function(x) { " + "console.log('[LoggingExternalInterface logging ' + literal(x, 'i32') " + "+ ']') },\n" + " 'log-i64': function(x, y) { " + "console.log('[LoggingExternalInterface logging ' + literal(x, 'i32') " + "+ ' ' + literal(y, 'i32') + ']') },\n" // legalization: two i32s + " 'log-f32': function(x) { " + "console.log('[LoggingExternalInterface logging ' + literal(x, 'f64') " + "+ ']') },\n" // legalization: an f64 + " 'log-f64': function(x) { " + "console.log('[LoggingExternalInterface logging ' + literal(x, 'f64') " + "+ ']') },\n" " },\n" " 'env': {\n" " 'setTempRet0': function(x) { tempRet0 = x },\n" @@ -73,12 +83,16 @@ static std::string generateJSWrapper(Module& wasm) { "});\n"; for (auto& exp : wasm.exports) { auto* func = wasm.getFunctionOrNull(exp->value); - if (!func) continue; // something exported other than a function - ret += "if (instance.exports.hangLimitInitializer) instance.exports.hangLimitInitializer();\n"; + if (!func) + continue; // something exported other than a function + ret += "if (instance.exports.hangLimitInitializer) " + "instance.exports.hangLimitInitializer();\n"; ret += "try {\n"; - ret += std::string(" console.log('[fuzz-exec] calling $") + exp->name.str + "');\n"; + ret += std::string(" console.log('[fuzz-exec] calling $") + exp->name.str + + "');\n"; if (func->result != none) { - ret += std::string(" console.log('[fuzz-exec] note result: $") + exp->name.str + " => ' + literal("; + ret += std::string(" console.log('[fuzz-exec] note result: $") + + exp->name.str + " => ' + literal("; } else { ret += " "; } @@ -110,4 +124,3 @@ static std::string generateJSWrapper(Module& wasm) { } } // namespace wasm - |