[PATCH] D26179: Bitcode: Introduce BitcodeWriter interface.
Peter Collingbourne via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 28 20:00:44 PST 2016
pcc marked an inline comment as done.
pcc added inline comments.
================
Comment at: llvm/tools/llvm-cat/llvm-cat.cpp:46
+ Writer.writeModule(M.get());
+ }
+
----------------
mehdi_amini wrote:
> 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)
Seems reasonable enough for now. Let's split it out into `llvm-bcutil binarycat` once we get around to that though.
https://reviews.llvm.org/D26179
More information about the llvm-commits
mailing list