I have compiled a C++11 program (test.cpp) into an LLVM IR file (test.ll) using clang++ 3.4. The program contains several C++ lambda functions, and I was wondering if it is possible to extract the IR for only the lambda functions using a technique like the following:
Module *mod = ParseIRFile("test.ll", *err, ctx);
for (Module::iterator f = mod->begin(); f != mod->end(); ++f) {
//is there some function like isLambdaFunction()?
if (f->isLambdaFunction()) {
cout << "Lambda Function" << endl;
}
}
No. There is no notion of lambda functions in LLVM IR. Clang lowers lambdas to structs with methods, AFAIK.
You could get this from Clang's AST, but not from LLVM IR.