[PATCH] D26778: Add llvm-modextract tool.

Mehdi AMINI via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 28 22:58:03 PST 2016


mehdi_amini added inline comments.


================
Comment at: llvm/tools/llvm-modextract/llvm-modextract.cpp:53
+
+  std::unique_ptr<Module> M = ExitOnErr(Ms[ModuleIndex].parseModule(Context));
+
----------------
For symmetry with llvm-cat, can we have the same `-b` option:


```
  std::error_code EC;
  std::unique_ptr<tool_output_file> Out(
      new tool_output_file(OutputFilename, EC, sys::fs::F_None));
  ExitOnErr(errorCodeToError(EC));
 
  if (BinaryExtract) {
     // Write header
     ...
     //Dump Ms[ModuleIndex].getBuffer() in Out->os()
     ...
     return 0;
  }

  std::unique_ptr<Module> M = ExitOnErr(Ms[ModuleIndex].parseModule(Context));
  WriteBitcodeToFile(M.get(), Out->os());
```


https://reviews.llvm.org/D26778





More information about the llvm-commits mailing list