c++ - Function name mangling in clang -


i create function on c, after translated llvm code clang has specific name. 1 problem - target function name must contains point ('.'). there possibility add "myname." name mangling, except "find , replace"?

name mangling utilized other binaries importing function/variable dllimport.

if aren't utilizing method, can whatever want name. if are, have modify whatever referencing well.

to point, you'd create llvm ir pass (look @ opt , etc.) set function name in target.

simple example:

for(auto f = m.getfunctionlist().begin(); f != m.getfunctionlist().end(); f = m.getfunctionlist().begin()) {     if (f->getname().find("mymangledfunctionname") != stringref::npos) {         f->setname(f->getname() + "."); // add "dot"     } } 

"m" variable being llvm::module.


Comments