search for: lambdabody

Displaying 1 result from an estimated 1 matches for "lambdabody".

2015 Oct 27
3
Add a mapping to a C++ lambda
...e> Owner = make_unique<Module>("SomeModule", Context); Module *M = Owner.get(); FunctionType *lambdaFT = FunctionType::get(Type::getInt32Ty(Context), false); Function *lambdaFN = Function::Create(lambdaFT, Function::ExternalLinkage, "lambda", Owner.get()); auto lambdaBody = []() { return 100; }; Function *mainF = cast<Function>(M->getOrInsertFunction("main", Type::getInt32Ty(Context), (Type *) 0)); BasicBlock *BB = BasicBlock::Create(Context, "EntryBlock", mainF); IRBuilder<> builder(BB); CallInst *lambdaRes = builder.Cr...