Commit ae8f9d61 authored by nagayama15's avatar nagayama15

Write module into stdout if output file name is '-'

parent 948d2592
...@@ -15,14 +15,22 @@ int main(int argc, char *argv[]) { ...@@ -15,14 +15,22 @@ int main(int argc, char *argv[]) {
return 1; return 1;
} }
const std::string inputFile = argv[1];
const std::string watermark = argv[2];
const std::string outputFile = argv[3];
wasm::Module module; wasm::Module module;
wasm::ModuleReader{}.read(argv[1], module); wasm::ModuleReader{}.read(inputFile, module);
const auto stream = kyut::CircularBitStream::from_string(argv[2]); const auto stream = kyut::CircularBitStream::from_string(watermark);
kyut::pass::embedWatermarkOperandSwapping(module, *stream); kyut::pass::embedWatermarkOperandSwapping(module, *stream);
wasm::ModuleWriter{}.write(module, argv[3]); if (outputFile == "-") {
wasm::ModuleWriter{}.writeBinary(module, "");
} else {
wasm::ModuleWriter{}.write(module, outputFile);
}
} catch (wasm::ParseException &e) { } catch (wasm::ParseException &e) {
fmt::print(std::cerr, "parse error\n"); fmt::print(std::cerr, "parse error\n");
e.dump(std::cerr); e.dump(std::cerr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment