<div dir="ltr">Hi, I am writing a program here hello.cpp for taking LLVM IR as a command line argument. My IR file is "input.bc" . But I dont understand how it make it via command line argument. <div><br></div><div>I am running this hello.cpp as: </div><div>g++ hello.cpp  -I /tmp/llvm/include/ -std=c++11 input.bc</div><div><br></div><div>But it shows error. Please suggest me correct way of taking llvm ir file as CLA. Here, is mine program:</div><div><br></div><div>----------</div><div><div>#include "llvm/Bitcode/BitcodeReader.h"</div><div>#include "llvm/IR/Function.h"</div><div>#include "llvm/IR/LLVMContext.h"</div><div>#include "llvm/IR/Module.h"</div><div>#include "llvm/Support/CommandLine.h"</div><div>#include "llvm/Support/ErrorOr.h"</div><div>#include "llvm/Support/MemoryBuffer.h"</div><div>#include "llvm/Support/raw_ostream.h"</div><div><br></div><div>using namespace llvm;</div><div><br></div><div>static cl::opt<std::string></div><div>FileName(cl::Positional, cl::desc("Bitcode file"),</div><div>         cl::Required);</div><div><br></div><div>int main(int argc, char** argv)</div><div>{</div><div>  cl::ParseCommandLineOptions(argc, argv, "LLVM hello world\n");</div><div>  LLVMContext context;</div><div><br></div><div>  ErrorOr<std::unique_ptr<MemoryBuffer>> mb = MemoryBuffer::getFile(FileName);</div><div>  if (std::error_code ec = mb.getError()) {</div><div>    errs() << ec.message();</div><div>    return -1;</div><div>  }</div><div><br></div><div>//  ErrorOr<Module *> m = parseBitcodeFile(mb->get(), context);</div><div>//  if (std::error_code ec = m.getError()) {</div><div>  Expected<std::unique_ptr<Module>> m = parseBitcodeFile(mb->get()->getMemBufferRef(), context);</div><div>        if (std::error_code ec = errorToErrorCode(m.takeError())) {</div><div>    errs() << "Error reading bitcode: " << ec.message() << "\n";</div><div>    return -1;</div></div><div><div>}</div><div><br></div><div>  for (Module::const_iterator I = (*m)->getFunctionList().begin(),</div><div>    E = (*m)->getFunctionList().end(); I != E; ++I) {</div><div>    if (!I->isDeclaration()) {</div><div>      outs() << I->getName() << " has " << I->size() << " basic blocks.\n";</div><div>    }</div><div>  }</div><div><br></div><div>  return 0;</div><div>}</div></div><div>--------------</div></div>