[llvm-dev] How to read String value of GlobalVariable?

Mahesh Attarde via llvm-dev llvm-dev at lists.llvm.org
Tue Mar 20 23:22:46 PDT 2018


Hi
 I have IR Code like

...
@path = private constant [6xi8] c"abcde\00"
...


--- Code from Pass ---
GlobalVariable * GVPath = ....  // contains @path

I want to convert "abcde" to StringRef. Can you  help me with
GlobalVariable API?

GlobalVariable::getInitializer() --> Constant*  // How to get exact value
äbcde from here?

~mahesh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180321/fc70ed6d/attachment.html>


More information about the llvm-dev mailing list