diff options
author | Alon Zakai <alonzakai@gmail.com> | 2018-06-07 19:23:49 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-07 19:23:49 -0700 |
commit | 7676221b837bbd20daf1889dbdabf3cb76721658 (patch) | |
tree | 32f5721cdcf90cf0e4316fc2ba131549c8a90f8e /src/tools/wasm-dis.cpp | |
parent | 3af404435b3cfa90704810370703f20921c055dd (diff) | |
download | binaryen-7676221b837bbd20daf1889dbdabf3cb76721658.tar.gz binaryen-7676221b837bbd20daf1889dbdabf3cb76721658.tar.bz2 binaryen-7676221b837bbd20daf1889dbdabf3cb76721658.zip |
wasm-opt source map support (#1557)
* support source map input in wasm-opt, refactoring the loading code into wasm-io
* use wasm-io in wasm-as
* support output source maps in wasm-opt
* add a test for wasm-opt and source maps
Diffstat (limited to 'src/tools/wasm-dis.cpp')
-rw-r--r-- | src/tools/wasm-dis.cpp | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/src/tools/wasm-dis.cpp b/src/tools/wasm-dis.cpp index da1a56b6b..3ff6819a5 100644 --- a/src/tools/wasm-dis.cpp +++ b/src/tools/wasm-dis.cpp @@ -21,7 +21,7 @@ #include "support/colors.h" #include "support/command-line.h" #include "support/file.h" -#include "wasm-binary.h" +#include "wasm-io.h" #include "wasm-printing.h" using namespace cashew; @@ -45,22 +45,10 @@ int main(int argc, const char *argv[]) { }); options.parse(argc, argv); - auto input(read_file<std::vector<char>>(options.extra["infile"], Flags::Binary, options.debug ? Flags::Debug : Flags::Release)); - if (options.debug) std::cerr << "parsing binary..." << std::endl; Module wasm; try { - std::unique_ptr<std::ifstream> sourceMapStream; - WasmBinaryBuilder parser(wasm, input, options.debug); - if (sourceMapFilename.size()) { - sourceMapStream = make_unique<std::ifstream>(); - sourceMapStream->open(sourceMapFilename); - parser.setDebugLocations(sourceMapStream.get()); - } - parser.read(); - if (sourceMapStream) { - sourceMapStream->close(); - } + ModuleReader().readBinary(options.extra["infile"], wasm, sourceMapFilename); } catch (ParseException& p) { p.dump(std::cerr); std::cerr << '\n'; |