- To: Ian Lance Taylor <iant@xxxxxxxxxx>
- Subject: Re: Re: GCC Plugin TRANSLATION_UNIT_DECL - Parsing global functions
- From: "Mario Miller" <mario-miller@xxxxxx>
- Date: Thu, 16 Aug 2012 15:28:50 +0200
- Cc: gcc-help@xxxxxxxxxxx
- Comment: DKIM? See http://www.dkim.org
- Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys
- In-reply-to: <CAKOQZ8yDvOZJP0C--+dis8x5PMEdLUu9b=Rpso7E1By-2TZY-w@mail.gmail.com>
-------- Original-Nachricht --------
> Datum: Wed, 15 Aug 2012 08:43:36 -0700
> Von: Ian Lance Taylor <iant@xxxxxxxxxx>
> An: Mario Miller <mario-miller@xxxxxx>
> CC: gcc-help@xxxxxxxxxxx
> Betreff: Re: GCC Plugin TRANSLATION_UNIT_DECL - Parsing global functions
> On Wed, Aug 15, 2012 at 4:15 AM, Mario Miller <mario-miller@xxxxxx> wrote:
> > I am writing a GCC Plugin which can parse the bodies of functions.
> > Parsing member functions of classes works pretty well, but when I
> > want to parse a global function and use the DECL_CONTEXT Makro I
> > get a TRANSLATION_UNIT_DECL. For member functions I use the
> > DECL_SAVED_TREE Makro to parse the function body; this works.
> > But when I use this Makro on a global function it returns NULL
> > always. My code looks a bit like this:
>
> If you have a TRANSLATION_UNIT_DECL, look in DECL_INITIAL to see the
> BLOCK for the namespace that it describes.
>
> Ian
I tried the DECL_INITIAL Makro on the TRANSLATION_UNIT_DECL tree and on the FUNCTION_DECL tree. In both cases it always returns NULL; so i do not get the BLOCK for the namespace.
[Linux C Programming]
[Linux Kernel]
[eCos]
[Fedora Development]
[Fedora Announce]
[Autoconf]
[The DWARVES Debugging Tools]
[Yosemite Campsites]
[Yosemite News]
[Linux GCC]