[PATCH] D26179: Bitcode: Introduce BitcodeWriter interface.
Mehdi AMINI via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 28 19:13:38 PST 2016
mehdi_amini added inline comments.
================
Comment at: llvm/include/llvm/Bitcode/BitcodeWriter.h:35
+
+ /// \brief Write the specified module to the buffer specified at
+ /// construction time.
----------------
`\brief` is only useful if there is more than one sentence.
================
Comment at: llvm/tools/llvm-cat/llvm-cat.cpp:46
+ Writer.writeModule(M.get());
+ }
+
----------------
So, if I followed correctly, we should be able to do now as well:
```
{
SmallVector<char, 0> Buffer;
BitcodeWriter Writer(Buffer);
}
for (std::string InputFilename : InputFilenames) {
std::unique_ptr<MemoryBuffer> MB =
ExitOnErr(errorOrToExpected(MemoryBuffer::getFileOrSTDIN(InputFilename)));
std::vector<BitcodeModule> Mods = ExitOnErr(getBitcodeModuleList(*MB));
for (auto &BitcodeMod : Mods)
Buffer.insert(Buffer.end(), BitcodeMod.getBuffer().begin(), BitcodeMod.getBuffer().end());
}
```
Can we put this behind an option in llvm-cat? I'm not sure sure it is worth creating `llvm-binarycat` for this.
(Also it makes me notice that your current implementation wouldn't handle input files that contains multiple modules)
https://reviews.llvm.org/D26179
More information about the llvm-commits
mailing list