| 97 | } |
| 98 | |
| 99 | static void WriteBufferToFile(std::string_view filename, |
| 100 | const OutputBuffer& buffer) { |
| 101 | if (s_dump_module) { |
| 102 | std::unique_ptr<FileStream> stream = FileStream::CreateStdout(); |
| 103 | if (s_verbose) { |
| 104 | stream->Writef(";; dump\n"); |
| 105 | } |
| 106 | if (!buffer.data.empty()) { |
| 107 | stream->WriteMemoryDump(buffer.data.data(), buffer.data.size()); |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | if (filename == "-") { |
| 112 | buffer.WriteToStdout(); |
| 113 | } else { |
| 114 | buffer.WriteToFile(filename); |
| 115 | } |
| 116 | } |
| 117 | |
| 118 | static std::string DefaultOuputName(std::string_view input_name) { |
| 119 | // Strip existing extension and add .wasm |
no test coverage detected