<div><div dir="auto">PrintAsOperand works on a Value object. You tried to call it on a StringRef. You need to change the set to use std::string instead of StringRef and call printAsOperand when you put data into the set.</div></div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Apr 24, 2019 at 1:43 PM hameeza ahmed via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>it is working fine for alphabetic labels....but numeric labels are not displayed by stringref.</div><div><br></div><div>what is the issue?</div><div>please help..<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Apr 24, 2019 at 2:27 AM hameeza ahmed <<a href="mailto:hahmed2305@gmail.com" target="_blank">hahmed2305@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"> for (set<StringRef>::iterator sit = L.begin(); sit != L.end(); sit++) {</div><div dir="ltr">std::string spr;<br> raw_string_ostream string_stream(spr);</div><div dir="ltr">sit->printAsOperand(string_stream, false);}</div><div dir="ltr"><br></div><div>this is giving error of <b>printasoperand </b>not member of sit<br></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Apr 24, 2019 at 2:16 AM hameeza ahmed <<a href="mailto:hahmed2305@gmail.com" target="_blank">hahmed2305@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Yes..agree I tried it...But this doesnot work with stringref..<br></div></blockquote></div></blockquote></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Apr 24, 2019 at 2:15 AM Justin Bogner <<a href="mailto:mail@justinbogner.com" target="_blank">mail@justinbogner.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Assuming you have an `Instruction *` or a `Value *`, you probably want<br>
`X->printAsOperand(errs(), /*PrintType=*/false)` or so.<br>
<br>
David Blaikie via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> writes:<br>
> Oh, sorry, adding the mailing list back (since I don't know if/how to<br>
> get the numbers) - perhaps someone else can suggest how to do that.<br>
><br>
> I'd go and look at how the IR AsmPrinter does this, if I were trying<br>
> to figure it out.<br>
><br>
> On Tue, Apr 23, 2019 at 1:26 PM hameeza ahmed <<a href="mailto:hahmed2305@gmail.com" target="_blank">hahmed2305@gmail.com</a>> wrote:<br>
>><br>
>> How to display these %num stored in stringref?<br>
>><br>
>> On Wed, Apr 24, 2019 at 1:25 AM David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>> wrote:<br>
>>><br>
>>> Ah, this is a function of where you're getting the names from, not<br>
>>> where/how you're printing them out.<br>
>>><br>
>>> %num named values in LLVM IR aren actually nameless - the numbering is<br>
>>> only used for textual rendering, not as an actual name. These %num<br>
>>> values will return false from "hasName".<br>
>>><br>
>>> On Tue, Apr 23, 2019 at 1:18 PM hameeza ahmed <<a href="mailto:hahmed2305@gmail.com" target="_blank">hahmed2305@gmail.com</a>> wrote:<br>
>>> ><br>
>>> > the code is compiled and executed.<br>
>>> > When the strings are name they are displayed...<br>
>>> > when strings are %number they are not dispalyed<br>
>>> ><br>
>>> > On Wed, Apr 24, 2019 at 1:15 AM David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>> wrote:<br>
>>> >><br>
>>> >> Does the code compile and execute? If so, I guess the strings in your<br>
>>> >> set are empty/zero-length.<br>
>>> >><br>
>>> >> On Tue, Apr 23, 2019 at 12:41 PM hameeza ahmed via llvm-dev<br>
>>> >> <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br>
>>> >> ><br>
>>> >> > Hello,<br>
>>> >> > I want to display the variable names in stringref<br>
>>> >> > iterator. But it is not displayed using following code.<br>
>>> >> ><br>
>>> >> ><br>
>>> >> > for (set<StringRef>::iterator sit = L.begin(); sit != L.end(); sit++) {<br>
>>> >> > errs() << *sit << " ";<br>
>>> >> > }<br>
>>> >> ><br>
>>> >> > How to do this?<br>
>>> >> > Please help..<br>
>>> >> > _______________________________________________<br>
>>> >> > LLVM Developers mailing list<br>
>>> >> > <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
>>> >> > <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
> _______________________________________________<br>
> LLVM Developers mailing list<br>
> <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
> <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>
</blockquote></div>
</blockquote></div>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">~Craig</div>