[llvm-dev] How to pass a StringRef to a function call inserted as instrumentation?

Dipanjan Das via llvm-dev llvm-dev at lists.llvm.org
Fri Apr 28 16:44:13 PDT 2017


StringRef::data, basically char*

On 28 April 2017 at 16:37, 陳韋任 <chenwj.cs97g at g2.nctu.edu.tw> wrote:

> StringRef::str().c_str() or StringRef::data()?
>
> 2017-04-29 7:32 GMT+08:00 Dipanjan Das via llvm-dev <
> llvm-dev at lists.llvm.org>:
>
>>
>> I am wriitng an LLVM pass to insert instrumentation at certain points of
>> the program. I want to pass the `StringRef` obtained from `getName()` as a
>> parameter to a function `func(char* s)`. I can allocate some space on stack
>> using `AllocaInst` to generate an `alloca` instruction. But, how can I copy
>> the `StringRef` to the stack space?
>>
>> --
>>
>> Thanks & Regards,
>> Dipanjan
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> llvm-dev at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>>
>>
>
>
> --
> Wei-Ren Chen (陳韋任)
> Homepage: https://people.cs.nctu.edu.tw/~chenwj
>



-- 

Thanks & Regards,
Dipanjan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170428/c449fd7f/attachment.html>


More information about the llvm-dev mailing list