【发布时间】:2015-04-22 12:08:02
【问题描述】:
我想在 LLVM IR 中创建一个空函数
void foo(){
}
我用
LLVMContext Context;
std::unique_ptr<Module> Owner(new Module("test", Context));
Module *M = Owner.get();
Function *foo =
cast<Function>(M->getOrInsertFunction("foo", Type::getVoidTy(Context),
Type::getVoidTy(Context),
(Type *)0));
编译但给我这个错误在运行时:
llvm-3.7.src/lib/IR/Type.cpp:350: llvm::FunctionType::FunctionType(llvm::Type*, llvm::ArrayRef, bool): 断言`isValidArgumentType(Params[i]) &&“不是函数参数的有效类型!”'失败。 * 崩溃并返回代码:0 *
关于我们如何在 LLVM 中执行 void foo(){} 函数有任何想法吗?
【问题讨论】: