#include "llvm/Bitcode/BitcodeReader.h"
#include "llvm/Bitcode/BitcodeWriter.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/ToolOutputFile.h"
#include "llvm/Support/WithColor.h"
usingnamespacellvm;
static cl::OptionCategory ModextractCategory("Modextract Options");
static cl::opt<bool>
BinaryExtract("b", cl::desc("Whether to perform binary extraction"),
cl::cat(ModextractCategory));
static cl::opt<std::string> OutputFilename("o", cl::Required,
cl::desc("Output filename"),
cl::value_desc("filename"),
cl::cat(ModextractCategory));
static cl::opt<std::string> InputFilename(cl::Positional,
cl::desc("<input bitcode>"),
cl::init("-"),
cl::cat(ModextractCategory));
static cl::opt<unsigned> ModuleIndex("n", cl::Required,
cl::desc("Index of module to extract"),
cl::value_desc("index"),
cl::cat(ModextractCategory));
int main(int argc, char **argv) { … }