diff options
author | Sam Clegg <sbc@chromium.org> | 2019-10-15 14:41:55 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-15 14:41:55 -0700 |
commit | 1abfe595aae2baa68c2888e53ac7f2890f9a75b5 (patch) | |
tree | e358527e53688fedb78f47ab2303d89bdd6759aa /src/tools/wasm-opt.cpp | |
parent | d63b8a44d8db26f88d2b30920ad4eea4afe43fae (diff) | |
download | binaryen-1abfe595aae2baa68c2888e53ac7f2890f9a75b5.tar.gz binaryen-1abfe595aae2baa68c2888e53ac7f2890f9a75b5.tar.bz2 binaryen-1abfe595aae2baa68c2888e53ac7f2890f9a75b5.zip |
Use early return in wasm-opt.cpp. NFC (#2387)
Diffstat (limited to 'src/tools/wasm-opt.cpp')
-rw-r--r-- | src/tools/wasm-opt.cpp | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/src/tools/wasm-opt.cpp b/src/tools/wasm-opt.cpp index 130e284c2..33e9a0396 100644 --- a/src/tools/wasm-opt.cpp +++ b/src/tools/wasm-opt.cpp @@ -363,29 +363,30 @@ int main(int argc, const char* argv[]) { } if (options.extra.count("output") == 0) { - std::cerr << "(no output file specified, not emitting output)\n"; - } else { - if (options.debug) { - std::cerr << "writing..." << std::endl; - } - ModuleWriter writer; - writer.setDebug(options.debug); - writer.setBinary(emitBinary); - writer.setDebugInfo(options.passOptions.debugInfo); - if (outputSourceMapFilename.size()) { - writer.setSourceMapFilename(outputSourceMapFilename); - writer.setSourceMapUrl(outputSourceMapUrl); - } - writer.write(*curr, options.extra["output"]); + std::cerr << "no output file specified, not emitting output\n"; + return 0; + } - if (extraFuzzCommand.size() > 0) { - auto secondOutput = runCommand(extraFuzzCommand); - std::cout << "[extra-fuzz-command second output:]\n" - << firstOutput << '\n'; - if (firstOutput != secondOutput) { - std::cerr << "extra fuzz command output differs\n"; - abort(); - } + if (options.debug) { + std::cerr << "writing..." << std::endl; + } + ModuleWriter writer; + writer.setDebug(options.debug); + writer.setBinary(emitBinary); + writer.setDebugInfo(options.passOptions.debugInfo); + if (outputSourceMapFilename.size()) { + writer.setSourceMapFilename(outputSourceMapFilename); + writer.setSourceMapUrl(outputSourceMapUrl); + } + writer.write(*curr, options.extra["output"]); + + if (extraFuzzCommand.size() > 0) { + auto secondOutput = runCommand(extraFuzzCommand); + std::cout << "[extra-fuzz-command second output:]\n" << firstOutput << '\n'; + if (firstOutput != secondOutput) { + std::cerr << "extra fuzz command output differs\n"; + abort(); } } + return 0; } |