C++ 无法按预期进行转换<;独特的_ptr<;模块>&燃气轮机;模块化

C++ 无法按预期进行转换<;独特的_ptr<;模块>&燃气轮机;模块化,c++,c++11,llvm,llvm-ir,C++,C++11,Llvm,Llvm Ir,我是llvm新手,正在编写的程序“main.cpp” 我在执行命令时遇到了错误:“pm.run(m)” 错误:调用“llvm::legacy::PassManager::run(llvm::Expected&)”时没有匹配的函数 以下是我的源代码: #include "backened.h" #include <iostream> #include "llvm/Bitcode/BitcodeReader.h" #include "llvm/IR/Function.h" #inclu

我是llvm新手,正在编写的程序“main.cpp”

我在执行命令时遇到了错误:“pm.run(m)”

错误:调用“llvm::legacy::PassManager::run(llvm::Expected&)”时没有匹配的函数
以下是我的源代码:

#include "backened.h"
#include <iostream>
#include "llvm/Bitcode/BitcodeReader.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ErrorOr.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/IR/PassManager.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/IR/DataLayout.h"
#include <llvm/Transforms/Scalar.h>
#include "llvm/IR/LegacyPassManager.h"

using namespace llvm;
using namespace std;

static cl::opt<string> input(cl::Positional, cl::desc("Bitcode File.."),cl::Required);
static cl::opt<string> classname("classname",cl::desc("Binary name of the generated class..."));

int main(int argc, char** argv)
{
        cl::ParseCommandLineOptions(argc, argv, "Hi..");
        LLVMContext context;

        ErrorOr<unique_ptr<MemoryBuffer>>  mb = MemoryBuffer::getFile(input);
        if(error_code ec = mb.getError()) {
                errs() << ec.message();
                return 1;
        }    
        Expected<unique_ptr<Module>> m = parseBitcodeFile(mb->get()->getMemBufferRef(),context);
        if(error_code ec= errorToErrorCode(m.takeError()) )
        {
           errs() <<"Unable to read bitcode file.." <<ec.message() ;
        }
        PassManager<Module> pm; 

    pm.add(createVerifierPass());    
    pm.add(createGCLoweringPass());    
    pm.add(createLowerSwitchPass());
    pm.add(createCFGSimplificationPass());
    pm.add(new JVMWriter(fouts(), classname, debugLevel));    
    pm.add(createGCInfoDeleter());    
    pm.run(*m);    
    return 0;
}
#包括“backed.h”
#包括
#包括“llvm/Bitcode/BitcodeReader.h”
#包括“llvm/IR/Function.h”
#包括“llvm/IR/LLVMContext.h”
#包括“llvm/IR/Module.h”
#包括“llvm/Support/CommandLine.h”
#包括“llvm/Support/error.h”
#包括“llvm/Support/MemoryBuffer.h”
#包括“llvm/Support/raw_ostream.h”
#包括“llvm/IR/PassManager.h”
#包括“llvm/CodeGen/passs.h”
#包括“llvm/IR/DataLayout.h”
#包括
#包括“llvm/IR/LegacyPassManager.h”
使用名称空间llvm;
使用名称空间std;
静态cl::opt输入(cl::Positional,cl::desc(“位码文件”),cl::Required);
静态cl::opt classname(“classname”,cl::desc(“生成的类的二进制名称…”));
int main(int argc,字符**argv)
{
cl::ParseCommandLineOptions(argc,argv,“Hi.”);
语境;
ErrorOr mb=MemoryBuffer::getFile(输入);
if(错误代码ec=mb.getError()){
errs()get()->getMemBufferRef(),context);
如果(错误代码ec=errorToErrorCode(m.takeError()))
{

errs()您对预期生成的代码有多大信心?代码已经好几年没有被触及了-唯一的更新是在自述中添加了一条注释(就在几个小时前)说这个项目没有维护,并提出了备选方案。@molbdnilo,我只是参考了那个项目,你能帮我解决这个错误吗。我想你应该从调查作者建议的备选方案开始。@molbdnilo,我没有发现任何这样的作者建议的备选方案。请阅读e自述。
#include "backened.h"
#include <iostream>
#include "llvm/Bitcode/BitcodeReader.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ErrorOr.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/IR/PassManager.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/IR/DataLayout.h"
#include <llvm/Transforms/Scalar.h>
#include "llvm/IR/LegacyPassManager.h"

using namespace llvm;
using namespace std;

static cl::opt<string> input(cl::Positional, cl::desc("Bitcode File.."),cl::Required);
static cl::opt<string> classname("classname",cl::desc("Binary name of the generated class..."));

int main(int argc, char** argv)
{
        cl::ParseCommandLineOptions(argc, argv, "Hi..");
        LLVMContext context;

        ErrorOr<unique_ptr<MemoryBuffer>>  mb = MemoryBuffer::getFile(input);
        if(error_code ec = mb.getError()) {
                errs() << ec.message();
                return 1;
        }    
        Expected<unique_ptr<Module>> m = parseBitcodeFile(mb->get()->getMemBufferRef(),context);
        if(error_code ec= errorToErrorCode(m.takeError()) )
        {
           errs() <<"Unable to read bitcode file.." <<ec.message() ;
        }
        PassManager<Module> pm; 

    pm.add(createVerifierPass());    
    pm.add(createGCLoweringPass());    
    pm.add(createLowerSwitchPass());
    pm.add(createCFGSimplificationPass());
    pm.add(new JVMWriter(fouts(), classname, debugLevel));    
    pm.add(createGCInfoDeleter());    
    pm.run(*m);    
    return 0;
}