[llvm-dev] LLVM-8.0 | Requesting Help : Function->getName() returns empty string

Manoj via llvm-dev llvm-dev at lists.llvm.org
Fri Aug 23 00:20:51 PDT 2019

Hello All,

I am creating a Module and getting Function pointer as below in some

Function *fn = module->getFunction(fnName);
printf("func Name: %s.\n", fn->getName().str().c_str());
return (intptr_t) fn;

This prints : "func Name: main." I convert the ptr to int and return it.

Later I am receiving this as a Func Handler in other function

executeFunction(int funcHandle . .) {
    Function *fn = (Function *) funcHandle;
    printf("func Name: %s\n",fn->getName().str().c_str());

    gv = executionEngine->runFunction(fn, *args);

Here it prints an empty string and also the executionEngine->runFunction()
gives error : Assertion failed! Expression: GV->hasName() && "Global must
have name."

I am using LLVM-8.0. Please let me know if I am missing out something OR if
the procedure is wrong

Best regards,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190823/43e2d121/attachment.html>

More information about the llvm-dev mailing list