public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Erick Ochoa <eochoa@gcc.gnu.org>
Cc: GCC Development <gcc@gcc.gnu.org>
Subject: Re: How to dump_decl_name to a string instead to a file?
Date: Thu, 1 Jul 2021 11:28:08 +0200	[thread overview]
Message-ID: <CAFiYyc1Z0iZ2Y_yXLFkwiJy2TnArguj8+HZRdypxXH+guJ6+bA@mail.gmail.com> (raw)
In-Reply-To: <CAJ_nqzhz_-TQc2YK17XTweJnq9LRS2n5SRCY-w=DSk_TNguWdQ@mail.gmail.com>

On Thu, Jul 1, 2021 at 9:40 AM Erick Ochoa via Gcc <gcc@gcc.gnu.org> wrote:
>
> Hello,
>
> I have a function that looks at identifiers of formal parameters. I
> found that when I ran this function on larger projects, the compiler
> segfaulted. I looked into this and I found that there are some formal
> parameters which have NULL in their DECL_NAME and that triggered a
> NULL dereference.
>
> I also noticed that these parameters when printed with
> dump_function_to_file were displayed using their DECL_UIDs. Digging a
> little bit deeper, the function responsible for printing parameters
> names is dump_decl_name. However, I am interested not in printing the
> names but having them as strings.
>
> I noticed that dump_decl_name takes a pretty_printer argument. Is it
> possible to somehow pass a pretty_printer and get the string instead
> of printing it?

You can look at its buffer I think.

Richard.

> Thanks!

      reply	other threads:[~2021-07-01  9:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-01  7:35 Erick Ochoa
2021-07-01  9:28 ` Richard Biener [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAFiYyc1Z0iZ2Y_yXLFkwiJy2TnArguj8+HZRdypxXH+guJ6+bA@mail.gmail.com \
    --to=richard.guenther@gmail.com \
    --cc=eochoa@gcc.gnu.org \
    --cc=gcc@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).