[llvm-dev] StringRef Iterator Variable Display

hameeza ahmed via llvm-dev llvm-dev at lists.llvm.org
Wed Apr 24 13:42:43 PDT 2019


it is working fine for alphabetic labels....but numeric labels are not
displayed by stringref.

what is the issue?
please help..

On Wed, Apr 24, 2019 at 2:27 AM hameeza ahmed <hahmed2305 at gmail.com> wrote:

>  for (set<StringRef>::iterator sit = L.begin(); sit != L.end(); sit++) {
> std::string spr;
>  raw_string_ostream string_stream(spr);
> sit->printAsOperand(string_stream, false);}
>
> this is giving error of *printasoperand *not member of sit
>
> On Wed, Apr 24, 2019 at 2:16 AM hameeza ahmed <hahmed2305 at gmail.com>
> wrote:
>
>> Yes..agree I tried it...But this doesnot work with stringref..
>>
>> On Wed, Apr 24, 2019 at 2:15 AM Justin Bogner <mail at justinbogner.com>
>> wrote:
>>
>>> Assuming you have an `Instruction *` or a `Value *`, you probably want
>>> `X->printAsOperand(errs(), /*PrintType=*/false)` or so.
>>>
>>> David Blaikie via llvm-dev <llvm-dev at lists.llvm.org> writes:
>>> > Oh, sorry, adding the mailing list back (since I don't know if/how to
>>> > get the numbers) - perhaps someone else can suggest how to do that.
>>> >
>>> > I'd go and look at how the IR AsmPrinter does this, if I were trying
>>> > to figure it out.
>>> >
>>> > On Tue, Apr 23, 2019 at 1:26 PM hameeza ahmed <hahmed2305 at gmail.com>
>>> wrote:
>>> >>
>>> >> How to display these %num stored in stringref?
>>> >>
>>> >> On Wed, Apr 24, 2019 at 1:25 AM David Blaikie <dblaikie at gmail.com>
>>> wrote:
>>> >>>
>>> >>> Ah, this is a function of where you're getting the names from, not
>>> >>> where/how you're printing them out.
>>> >>>
>>> >>> %num named values in LLVM IR aren actually nameless - the numbering
>>> is
>>> >>> only used for textual rendering, not as an actual name. These %num
>>> >>> values will return false from "hasName".
>>> >>>
>>> >>> On Tue, Apr 23, 2019 at 1:18 PM hameeza ahmed <hahmed2305 at gmail.com>
>>> wrote:
>>> >>> >
>>> >>> > the code is compiled and executed.
>>> >>> > When the strings are name they are displayed...
>>> >>> > when strings are %number they are not dispalyed
>>> >>> >
>>> >>> > On Wed, Apr 24, 2019 at 1:15 AM David Blaikie <dblaikie at gmail.com>
>>> wrote:
>>> >>> >>
>>> >>> >> Does the code compile and execute? If so, I guess the strings in
>>> your
>>> >>> >> set are empty/zero-length.
>>> >>> >>
>>> >>> >> On Tue, Apr 23, 2019 at 12:41 PM hameeza ahmed via llvm-dev
>>> >>> >> <llvm-dev at lists.llvm.org> wrote:
>>> >>> >> >
>>> >>> >> > Hello,
>>> >>> >> > I want to display the variable names in stringref
>>> >>> >> > iterator. But it is not displayed using following code.
>>> >>> >> >
>>> >>> >> >
>>> >>> >> > for (set<StringRef>::iterator sit = L.begin(); sit != L.end();
>>> sit++) {
>>> >>> >> > errs() << *sit << " ";
>>> >>> >> > }
>>> >>> >> >
>>> >>> >> > How to do this?
>>> >>> >> > Please help..
>>> >>> >> > _______________________________________________
>>> >>> >> > LLVM Developers mailing list
>>> >>> >> > llvm-dev at lists.llvm.org
>>> >>> >> > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>>> > _______________________________________________
>>> > LLVM Developers mailing list
>>> > llvm-dev at lists.llvm.org
>>> > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190425/d2658b05/attachment.html>


More information about the llvm-dev mailing list