[llvm-dev] StringRef Iterator Variable Display

Justin Bogner via llvm-dev llvm-dev at lists.llvm.org
Tue Apr 23 14:15:38 PDT 2019


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


More information about the llvm-dev mailing list