<div dir="ltr">Hi, I am new to llvm , writing the program "main.cpp" of <a href="https://github.com/davidar/lljvm/blob/master/backend/main.cpp">https://github.com/davidar/lljvm/blob/master/backend/main.cpp</a>.<div><br><div>I stuck at the error while executing the command : "pm.run(m)"</div></div><div>error: no matching function for call to ‘llvm::legacy::PassManager::run(llvm::Expected<std::unique_ptr<llvm::Module> >&)<br></div><div><br></div><div>Here is my source code: </div><div>---------</div><div>

<div style="font-size:12.8px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><div>#include "backened.h"</div><div>#include <iostream></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>#include "llvm/IR/PassManager.h"</div><div>#include "llvm/CodeGen/Passes.h"</div><div>#include "llvm/IR/DataLayout.h"</div><div>#include <llvm/Transforms/Scalar.h></div><div>#include "llvm/IR/LegacyPassManager.h"</div><div><br></div><div>using namespace llvm;</div><div>using namespace std;</div><div><br></div><div>static cl::opt<string> input(cl::Positional, cl::desc("Bitcode File.."),cl::Required);</div><div>static cl::opt<string> classname("classname",cl::<wbr>desc("Binary name of the generated class..."));</div><div><br></div><div>int main(int argc, char** argv)</div><div>{</div><div>        cl::ParseCommandLineOptions(<wbr>argc, argv, "Hi..");</div><div>        LLVMContext context;</div><div><br></div><div>        ErrorOr<unique_ptr<<wbr>MemoryBuffer>>  mb = MemoryBuffer::getFile(input);</div><div>        if(error_code ec = mb.getError()) {</div><div>                errs() << ec.message();</div><div>                return 1;</div><div>        }</div><div><br></div><div>        Expected<unique_ptr<Module>> m = parseBitcodeFile(mb->get()-><wbr>getMemBufferRef(),context);</div><div>        if(error_code ec= errorToErrorCode(m.takeError()<wbr>) )</div><div>        {</div><div>           errs() <<"Unable to read bitcode file.." <<ec.message() ;</div><div>        }</div></div><div style="font-size:12.8px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><div>        PassManager<Module> PM;      </div><div><table class="gmail-MsoNormalTable" border="0" cellspacing="0" cellpadding="0" style="background:white;border-collapse:collapse">
 <tbody><tr>
  <td valign="top" style="padding:0in 7.5pt">
  <p class="MsoNormal" style="margin-top:0in;margin-right:0in;margin-left:0in;line-height:107%;font-size:12pt;font-family:"Times New Roman",serif"><span>    </span>pm.add(createVerifierPass());</p>
  </td>
 </tr>
 <tr>
  <td valign="top" style="padding:0in 7.5pt">
  <p class="MsoNormal" style="margin-top:0in;margin-right:0in;margin-left:0in;line-height:107%;font-size:12pt;font-family:"Times New Roman",serif"><span>    </span>pm.add(createGCLoweringPass());</p>
  </td>
 </tr>
 <tr>
  <td valign="top" style="padding:0in 7.5pt">
  <p class="MsoNormal" style="margin-top:0in;margin-right:0in;margin-left:0in;line-height:107%;font-size:12pt;font-family:"Times New Roman",serif"><br></p>
  </td>
 </tr>
 <tr>
  <td valign="top" style="padding:0in 7.5pt">
  <p class="MsoNormal" style="margin-top:0in;margin-right:0in;margin-left:0in;line-height:107%;font-size:12pt;font-family:"Times New Roman",serif"><span>    </span>pm.add(createLowerSwitchPass());</p>
  </td>
 </tr>
 <tr>
  <td valign="top" style="padding:0in 7.5pt">
  <p class="MsoNormal" style="margin-top:0in;margin-right:0in;margin-left:0in;line-height:107%;font-size:12pt;font-family:"Times New Roman",serif"><span>    </span>pm.add(createCFGSimplificationPass());</p>
  </td>
 </tr>
 <tr>
  <td valign="top" style="padding:0in 7.5pt">
  <p class="MsoNormal" style="margin-top:0in;margin-right:0in;margin-left:0in;line-height:107%;font-size:12pt;font-family:"Times New Roman",serif"><span>    </span>pm.add(new JVMWriter(fouts(), classname, debugLevel));</p>
  </td>
 </tr>
 <tr>
  <td valign="top" style="padding:0in 7.5pt">
  <p class="MsoNormal" style="margin-top:0in;margin-right:0in;margin-left:0in;line-height:107%;font-size:12pt;font-family:"Times New Roman",serif"><span>    </span>pm.add(createGCInfoDeleter());</p>
  </td>
 </tr>
 <tr>
  <td valign="top" style="padding:0in 7.5pt">
  <p class="MsoNormal" style="margin-top:0in;margin-right:0in;margin-left:0in;line-height:107%;font-size:12pt;font-family:"Times New Roman",serif"><span>   </span><span> </span>pm.run(*m);</p>
  </td>
 </tr>
</tbody></table>





</div></div><div style="font-size:12.8px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">        return 0;</div><div style="font-size:12.8px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">}</div><div style="font-size:12.8px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">------------------</div>

Please help me.</div></div>