How to pass StringRef or std::string type to external function

Hi,

I am trying to pass name of the file to external function but I am not able to figure out how I can do it. Below is the code -

auto *Scope = cast(Loc->getScope());
StringRef fileName = Scope->getFilename();
errs()<<“fileName:”<<fileName<<"\n";

Finish = M->getOrInsertFunction(“finish”, VoidTy);
IRB.CreateCall(Finish, {});

How should I pass fileName to “finish” call?

Regards,
Sangeeta

IRBuilder → CreateGlobalStringPtr

Zhang