MCPcopy Create free account
hub / github.com/WebAssembly/wabt / WriteBufferToFile

Function WriteBufferToFile

src/tools/wat2wasm.cc:99–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97}
98
99static 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
118static std::string DefaultOuputName(std::string_view input_name) {
119 // Strip existing extension and add .wasm

Callers 1

ProgramMainFunction · 0.85

Calls 7

WriteMemoryDumpMethod · 0.80
dataMethod · 0.80
WriteToStdoutMethod · 0.80
WritefMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45
WriteToFileMethod · 0.45

Tested by

no test coverage detected